ASP Recordset.RecordCount = -1 - TechRepublic
General discussion
April 20, 2001 at 06:54 AM
drewburlingame

ASP Recordset.RecordCount = -1

by drewburlingame . Updated 25 years, 2 months ago

This is killing me.
I’m using ASP 2.0 with SQL Server 7.0 and ADO 2.6
Here’s the code I’ve written.

Set cn = Server.CreateObject(“ADODB.Connection”)
set rs = Server.CreateObject(“ADODB.Recordset”)
set cmd = Server.CreateObject(“ADODB.Command”)

cn.Open DSN, UserName, Password
cmd.ActiveConnection = cmd.CommandText = “{call stpAccessQCforPO(?)}”
cmdAccess.Parameters.Append cmdAccess.CreateParameter(“@intCompanyID”, adInteger, adParamInput,, CompanyID)
set rsAccess = cmdAccess.Execute

When I run this;
for cn, the connection string is valid, the state is open, and there are no errors.
for the cmd, the active connection is a valid connection string, the command text is correct, the parameter name, type & value are all correct

But the recordset’s recordcount is -1. I can’t figure out why. I have several other stored procedures just like this and they all work fine. When I execute the stored procedure in the query analyzer, 2 records are returned. Also, when I callthe recordset’s activecommand propertie, an error is returned saying there was no value. I’m assuming that the command isn’t executing into the recordset, but I’m really not sure what the problem is. Any help is greatly appreciated.

Thanks,
Drew

This discussion is locked

All Comments