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

Dynamic Query Not Returning RecordCount

Status
Not open for further replies.

abdullauthan

Programmer
Apr 20, 2000
64
SA
I am using a Stored Procedure with Dynamic SQL Statements in SQL Server. If try to retrieve records using the Stored Procedure in VB (ADO Command & Recordset combination), there are no records retrieved. However if I extract the result to a MSHFlexGrid
(Set MSHFlexGrid1.DataSource=rstTest)
I can get the results. Still the RecordCount property of the rescordset is -1. I can get the results in SQL Query Analyzer also. Any help on this?
 
The recordcount property will return -1 if you are using a forward only cursor (the default cursor I believe). Depending on your data source, a dynamic cursor will also return -1. The value of -1 however does not mean your data did not get retreived, it just means that ADO was not able to determine how many records were returned.

Adam
 
You have to set the CursorLocation property to "adUseClient"
Then only it will return the record count. The default is Server side.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top