Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RecordCount Problem 1

Status
Not open for further replies.

Cheryl3D

Programmer
Mar 26, 2002
116
US
Hi:

I'm developing a web-based application using Dreamweaver MX with ASP on the front-end and MS SQL Server 2000 on the back-end.

I have the following code that creates a record set within Dreamweaver MX and I'm trying to use the RecordCount property of the record set to get a count of the number of records generated during runtime for the records listed on
the web page:

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<% Option Explicit
Dim strPreStatus %>
<!--#include file="../../Connections/sar.asp" -->

<%
Dim rsSuspenseLog
Dim rsSuspenseLog_numRows

Set rsSuspenseLog = Server.CreateObject("ADODB.Recordset")
rsSuspenseLog.ActiveConnection = MM_sar_STRING
rsSuspenseLog.Source = "SELECT * FROM dbo.QryUnionBase_ViewRpt"
rsSuspenseLog.CursorType = 0
rsSuspenseLog.CursorLocation = 2
rsSuspenseLog.LockType = 1
rsSuspenseLog.Open()

rsSuspenseLog_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index

Repeat1__numRows = -1
Repeat1__index = 0
rsSuspenseLog_numRows = rsSuspenseLog_numRows + Repeat1__numRows
%>

<% Function CountRecords
'returns the total records for the report.
CountRecords = rsSuspenseLog.RecordCount
End Function
%>



<html>
<head>
<title>Suspense Log Report</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<table width="100%" height="30" border="0" cellpadding="0">
<tr bordercolor="#000000" height="30">
....
<td width="25%"> <div align="right"><font size="3">Count: <%=CountRecords%></font></div></td>
</tr>
</table>

The problem is that when I run the report, I receive an error because the Count equals -1.
e.g. Count: -1

Can anyone advise on what the problem could be? Is this a SQL Server 2000 issue?

Any help on this matter would be greatly appreciated.

Thanks,
Cheryl





 
set the CursorLocation to be clientside. adUseClient (3)


faq333-618
faq333-4615

plus a forum search would turn up thousands of results.


Chris.

Indifference will be the downfall of mankind, but who cares?
A website that proves the cobblers kids adage.
Nightclub counting systems

So long, and thanks for all the fish.
 
Hi Chris:

Thanks, worked just great!!! Really appreciated your help.

Cheryl
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top