Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2002-05-08 : 09:34:30
|
| Abdulla writes "I am using a Stored Procedure with Dynamic SQL Statements in SQL Server 7 (SP3). 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?" |
|
|
timmy
Master Smack Fu Yak Hacker
1242 Posts |
Posted - 2002-05-08 : 09:41:09
|
Firstly, in ADO the RecordCount property is only of use if you run a Recordset.MoveLast command to get to the end of the recordset. After you create the recordset in Vb using the command and recordset method, check the recordset's EOF property. As an alternative to the command method, try this:cn.spName param1, param2, .... , rst where cn is your ADO connection, spName is your stored procedure name, and rst is your recordset. The param1,2 etc are the stored procedure parameters.I find this method a lot quicker to return a recordset. |
 |
|
|
|
|
|