Solved

ASP timeout on rs.movenext

Posted on 2004-04-06
4
1,353 Views
Last Modified: 2012-05-04
Hi,
I'm trying to return a record set from a stored procedure on SQL Server7.  The app seems to to timeout and reports the failure at the include file where the line is ...
while (!rs.eof) { reccnt++; rs.movenext(); }
I have tracked it down to being the actual rs.movenext() line but can't find a way around it or why it's falling over.  The stored procedure works fine and returns results when running it asa query through Access in about 10 seconds.  Via asp it just hangs.  Can anyone help me please?
Thanks in advance.
0
Comment
Question by:PranP
4 Comments
 
LVL 11

Accepted Solution

by:
Slimshaneey earned 500 total points
ID: 10765249
You can get the recordcount by using code like the following:

reccount = rs.recordcount

If it returns a value of -1 then you need to add this line before the recordset is created:
YourConnection.Cursorlocation = 3
0
 
LVL 15

Expert Comment

by:deighc
ID: 10765379
If all you want is a count of records from the database then use a SELECT COUNT(*) query.

This is alot faster than using the recordCount property of a the recordset object because you don't need a client-side static or keyset cursor (which are the slowest cursor types) and you only have a single record in your recordset.

In fact, if you're using a stored procedure and all you want to know is a record count then the absolute best performance will come by setting your record count as an output parameter of the stored procedure then using a command object to read the output parameter. That way you don't need a recordset object at all.
0
 
LVL 31

Expert Comment

by:alorentz
ID: 10765381
What language?  C#?

Post more code..
0
 

Author Comment

by:PranP
ID: 10765653
Thanks Slimshaneey,
The YourConnection.CursorLocation did the trick.  Pulled back results stragiht away.

Many Thanks,
PranP
0

Featured Post

ScreenConnect 6.0 Free Trial

Discover new time-saving features in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question