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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RecordCount Returning -1

Status
Not open for further replies.

stsuing

Programmer
Aug 22, 2001
596
0
0
US
I execute a SP that returns a record set. When I run it off one SQL server I get normal record count 0 - n records.

When I execute the same stored procedure off the production server it returns -1, even though I get records. MSDN say this is the problem.

The property returns -1 when ADO cannot determine the number of records

What would cause this.
 
i think when opening a connection u need to write this

rs.Open sqlstmt, Conn, adOpenStatic, adLockReadOnly
this returns the exact number of records
hope this helps
 
Thanks the key was adLockReadOnly
I had adLockBatchOptimistic
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top