Solved

ASP timeout on rs.movenext

Posted on 2004-04-06
4
1,348 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

708 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now