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 - 2001-02-07 : 17:12:52
|
Brit writes "I am using ASP to execute a SQL Server 7.0 stored procedure on a Windows NT 4.0 server. (ADO is version 2.5) The stored procedure is a very long, complex query that summarizes a table and pivots the results twice. When I do not use an EXEC in the stored procedure, I am able to get the number of records in the ADO recordset by opening the record set adOpenStatic and adLockReadOnly and using the .recordCount property. It appears that when the stored procedure includes an EXEC to build the query dynamically based on user input, none of the recordset properties (recordCount, MoveLast, etc.) work. (recordCount is always -1, moveLast erros with "Rowset does not support fetching backwards".) I need to use the recordCount to dimension arrays in which the recordset fields are stored. Articles suggest letting the database do the work by using the COUNT aggregate function. This would be very inefficient in this case, since the long, complex query would have to be run to determine the number of records it will produce and then run again to actually produce the recordset. All the workarounds I can think of are sub-optimal. Am I missing something? Does using an EXEC in the SQL proc really disable these ADO properties? Is there some cool trick I don't know about that will improve this situation? I would include my code, but it is hundreds of lines long. Thanks" |
|
|
|
|
|