Hello,
I have 2 queries, qryDept and qryExams. Because I can not join these queries together so I have to use 2 Record sets in ASP.
The NoStudents deduct from NoExams to get Remain.
It keeps getting errors at the --oRs2.Open strSQL2, Conn.
<% Dim Dept_ID, strSQL2, oRs2, Remain
strSQL = "SELECT Dept_ID, NoStudents FROM qryDept; " & _
strSQL2 = "SELECT Dept_ID, NoExams FROM qryExams " & _
" Where = qryExams.Dept_ID = qryDept.Dept_ID;"
Set oRs = Server.CreateObject("adodb.RecordSet")
oRs.Open strSQL, Conn
Set oRs2 = Server.CreateObject("adodb.RecordSet")
oRs2.Open strSQL2, Conn
if not oRs.eof then %>
<% do until oRs.eof %>
<tr>
<th><%=oRs("Dept_ID")%></th>
<th><%=oRs("NoStudents")%></th>
<% if not oRs2.eof then %>
<% do until oRs2.eof %>
<th><%=oRs2("NoExams")%></th>
<% Remain = <%=oRs("NoStudents")%>-<%=oRs2("NoExams")%>%>
<th><%=Remain%></th>
<% oRs2.MoveNext
loop %>
<% end if %>
<% oRs.MoveNext
loop %>
<% end if %>
Errors: Too few parameters. Expected 1. at Line ---oRs2.Open strSQL2, Conn
Can anyone please help how to fix this code to make it work?
Thanks very much and have a nice day.