ceeleelewis
Programmer
Hello All,
I want to display two separate list from information on two tables on my dB on one page. So far, I can generate one list from one of my tables. But when I try to display the second list along with the first, I get the following error:
ADODB.Recordset error '800a0e79' Operation is not allowed when the object is open. ?
Below is my code for review. Note: I don't want to "join" the two tables. I want two separate lists.
Sub subListUserInfo
Dim i, intFieldCount, intFieldCount_i, ii
'Define SQL Query
strSQL = "SELECT Username, Password, ID, URL FROM users ORDER BY Username"
'Open recordset passing the SQL to the connection object.
'Open as Static to be able to execute more Move commands in the recordset.
'
objRS.open strSQL, objConn, adOpenStatic, adLockOptimistic
'Check for errors in objConn
subErrorCheck
intFieldCount = objRS.Fields.Count
%>
<p align="center"><a href="aspccAdmin.asp?Add=1">Add New</a></p>
<table align="center" cellspacing="0" cellpadding="3" border="1">
<tr>
<% For i = 0 To intFieldCount -2 %>
<th><%= objRS(i).Name %></th>
<% Next %>
<th> </th>
</tr>
<% Do Until objRS.EOF %>
<tr>
<% For i = 0 To intFieldCount -2 %>
<td><%= objRS(i)%></td>
<% Next %>
<td>
<a href="aspccAdmin.asp?Edit=<%= objRS("ID"
%>">Edit</a> |
<a href="aspccAdmin.asp?Delete=<%= objRS("ID"
%>">Delete</a>
</td>
</tr>
<% objRS.Movenext %>
<% Loop %>
</table>
<%
'Define SQL Query
strSQL = "SELECT Username, Password,URL, reqFormId FROM users_II ORDER BY Username"
'Open recordset passing the SQL to the connection object.
'Open as Static to be able to execute more Move commands in the recordset.
'
objRS.open strSQL, objConn, adOpenStatic, adLockOptimistic
'Check for errors in objConn
subErrorCheck
intFieldCount = objRS.Fields.Count
%>
<p align="center"><a href="aspccAdmin.asp?Add=1">Add New</a></p>
<table align="center" cellspacing="0" cellpadding="3" border="1">
<tr>
<% For ii = 0 To intFieldCount_i -2 %>
<th><%= objRS(ii).Name %></th>
<% Next %>
<th> </th>
</tr>
<% Do Until objRS.EOF %>
<tr>
<% For ii = 0 To intFieldCount_i -2 %>
<td><%= objRS(ii)%></td>
<% Next %>
<td>
<a href="aspccAdmin.asp?Edit=<%= objRS("ID"
%>">Edit</a> |
<a href="aspccAdmin.asp?Delete=<%= objRS("ID"
%>">Delete</a>
</td>
</tr>
<% objRS.Movenext %>
<% Loop %>
</table>
<%
End Sub
I want to display two separate list from information on two tables on my dB on one page. So far, I can generate one list from one of my tables. But when I try to display the second list along with the first, I get the following error:
ADODB.Recordset error '800a0e79' Operation is not allowed when the object is open. ?
Below is my code for review. Note: I don't want to "join" the two tables. I want two separate lists.
Sub subListUserInfo
Dim i, intFieldCount, intFieldCount_i, ii
'Define SQL Query
strSQL = "SELECT Username, Password, ID, URL FROM users ORDER BY Username"
'Open recordset passing the SQL to the connection object.
'Open as Static to be able to execute more Move commands in the recordset.
'
objRS.open strSQL, objConn, adOpenStatic, adLockOptimistic
'Check for errors in objConn
subErrorCheck
intFieldCount = objRS.Fields.Count
%>
<p align="center"><a href="aspccAdmin.asp?Add=1">Add New</a></p>
<table align="center" cellspacing="0" cellpadding="3" border="1">
<tr>
<% For i = 0 To intFieldCount -2 %>
<th><%= objRS(i).Name %></th>
<% Next %>
<th> </th>
</tr>
<% Do Until objRS.EOF %>
<tr>
<% For i = 0 To intFieldCount -2 %>
<td><%= objRS(i)%></td>
<% Next %>
<td>
<a href="aspccAdmin.asp?Edit=<%= objRS("ID"
<a href="aspccAdmin.asp?Delete=<%= objRS("ID"
</td>
</tr>
<% objRS.Movenext %>
<% Loop %>
</table>
<%
'Define SQL Query
strSQL = "SELECT Username, Password,URL, reqFormId FROM users_II ORDER BY Username"
'Open recordset passing the SQL to the connection object.
'Open as Static to be able to execute more Move commands in the recordset.
'
objRS.open strSQL, objConn, adOpenStatic, adLockOptimistic
'Check for errors in objConn
subErrorCheck
intFieldCount = objRS.Fields.Count
%>
<p align="center"><a href="aspccAdmin.asp?Add=1">Add New</a></p>
<table align="center" cellspacing="0" cellpadding="3" border="1">
<tr>
<% For ii = 0 To intFieldCount_i -2 %>
<th><%= objRS(ii).Name %></th>
<% Next %>
<th> </th>
</tr>
<% Do Until objRS.EOF %>
<tr>
<% For ii = 0 To intFieldCount_i -2 %>
<td><%= objRS(ii)%></td>
<% Next %>
<td>
<a href="aspccAdmin.asp?Edit=<%= objRS("ID"
<a href="aspccAdmin.asp?Delete=<%= objRS("ID"
</td>
</tr>
<% objRS.Movenext %>
<% Loop %>
</table>
<%
End Sub