tasneem
05-06-2005, 05:01 PM
Hi
This is the code to retrieve records from access db to an asp page:
<!--#include file="dbconn.asp" --> 'my connection string.
<%
Dim rsmidtowncats
Dim rsmidtowncats_numRows
Set rsmidtowncats = Server.CreateObject("ADODB.Recordset")
Set midtowncnn = Server.CreateObject("ADODB.Connection")
midtowncnn.open dsnmidtown
strsql = "SELECT * FROM tblMasterCategoryNames"
rsmidtowncats.open strsql,midtowncnn,0,2,1
'rsmidtowncats.Open()
rsmidtowncats_numRows = 0
%>
Then I put this records in the table in this way:
<table border="0" id="tblmaincats">
<tr>
<td>MasterCategoryID</td>
<td>MasterCategoryName</td>
</tr>
<% While ((Repeat1__numRows <> 0) AND (NOT rsmidtowncats.EOF)) %>
<tr>
<td><%=(rsmidtown.Fields.Item("MasterCategoryID").Value) %></td>
<td><%=(rsmidtown.Fields.Item("MasterCategoryName").Value) %></td>
</tr>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
rsmidtowncats.MoveNext()
Wend
%>
</table>
Why is the returning an empty recordset?
The records here are only 4, and this is working in query in access db.
Can anyone help?
thanks
This is the code to retrieve records from access db to an asp page:
<!--#include file="dbconn.asp" --> 'my connection string.
<%
Dim rsmidtowncats
Dim rsmidtowncats_numRows
Set rsmidtowncats = Server.CreateObject("ADODB.Recordset")
Set midtowncnn = Server.CreateObject("ADODB.Connection")
midtowncnn.open dsnmidtown
strsql = "SELECT * FROM tblMasterCategoryNames"
rsmidtowncats.open strsql,midtowncnn,0,2,1
'rsmidtowncats.Open()
rsmidtowncats_numRows = 0
%>
Then I put this records in the table in this way:
<table border="0" id="tblmaincats">
<tr>
<td>MasterCategoryID</td>
<td>MasterCategoryName</td>
</tr>
<% While ((Repeat1__numRows <> 0) AND (NOT rsmidtowncats.EOF)) %>
<tr>
<td><%=(rsmidtown.Fields.Item("MasterCategoryID").Value) %></td>
<td><%=(rsmidtown.Fields.Item("MasterCategoryName").Value) %></td>
</tr>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
rsmidtowncats.MoveNext()
Wend
%>
</table>
Why is the returning an empty recordset?
The records here are only 4, and this is working in query in access db.
Can anyone help?
thanks