|
|
|
|
|
| | |
|
Active Server Pages what is asp programming how to sample asp example code scripts software asp forum mail sessions applications global.asa CJWSoft ASPProtect ASPBanner ASPClassifieds
(Advanced)
(Components)
(Database)
(General)
(Vbscript)

|
|
Subject: |
RecordCount Problems |
From: |
Pete |
Date: |
2/17/1999 4:34:00 AM |
IP: |
193.133.140.50 |
Im trying to just do a fancy bit of code that just displays a) how many records have been found b) which record you are currently at
The code example below is a cut down version but it show what Im trying to do. As my browser and server locked up if I executed a SQL query that returned tomany records Ive tried to use MaxRecords to limit the amount to 20.
Trouble Im having is that RecordCount seems to always be returned as -1 and therefore is being displayed as Unknown. This even happens when less then 20 records are returned which really makes me scratch my head!
Any ideas? If so can you explain any alterations and why you did them rather then just giving me the code, so I know what it does etc :)
<%
Declare Varibles
Dim DataConn
Dim CmdRS
Dim SQL
Dim Count
Count = 0
Set connection to Database
Set DataConn = Server.CreateObject("ADODB.Connection")
Set CmdRS = Server.CreateObject("ADODB.Recordset")
Open DB
DataConn.Open "DSN=incident"
SQL = "SELECT tablbase.* FROM tablbase"
Submit SQL statement
CmdRS.Maxrecords = 20
CmdRS.Open SQL, DataConn
%>
<body>
<h4>Query results :
<% If CmdRS.Recordcount = -1 then
response.write "Unknown Number Of"
Else
response.write CmdRS.recordcount
End If%> Records Returned</h4>
<% While NOT CmdRS.EOF
count = count + 1%> </p>
Record <%=count%> Of <% If CmdRS.Recordcount = -1 then
response.write "Unknown"
Else
response.write CmdRS.recordcount
End If%>
<!--Display Record Set Data Here-->
<% CmdRS.MoveNext
Wend %>
Thanks in advance
Pete |
Follow Up - Re: RecordCount Problems - Harlan 2/17/1999 8:39:57 AM
Follow Up - Re: From the book - Harlan 2/17/1999 11:11:07 AM
Follow Up - Re: RecordCount Problems - Raymond Skorstad 8/26/1999 7:43:35 AM
|
|

|
|
|
|
|
|
|
|
|
|