Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Problem using cursorlocation for recordset

Reply
Thread Tools

Problem using cursorlocation for recordset

 
 
Bob Barrows [MVP]
Guest
Posts: n/a
 
      06-06-2007
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> The description you gave about the way the records are sorted is
> right.
> I am sorry about the confusion on the client/server side.I am using
> client side cursor.
> I tried using the sql profiler yday and what I found is that the first
> time the search is done the select query is called straight but the
> second time a cursor.open method is used and then after the
> cursor.fetch I see the cursor.close when I am getting the timeout.
> Here is the code I am trying to use
>
> Set Connection = Session("Connectionname")


This is bad! You are storing an ADO Connection in Session. See:
http://www.aspfaq.com/show.asp?id=2053
Store the connection string in Application (not Session - only use
Session for variables that are user-dependant). In you ASP page,
instantiate a new Connection object and open it using the string stored
in Application. Always close the connection as soon as you are finished
with it. Allow ADO Session Pooling to work for you.

This is probably the root of your problem. Since you don't close the
connection, it is likely to still be busy with the previous resultset,
and therefore uses the cursor, which is very slow as you now have
verified.

The secondary lesson you should be learning from this is that cursors
should be avoided if possible.

> Set rs = Server.CreateObject("ADODB.Recordset")
> rs.CursorLocation = 3
> SQLText = "select * from CaseData"
> rs.Open SQLText, Connection,1,3


<gasp>
You're retrieving ALL the records??? Why aren't you using a WHERE clause
to limit the records retrieved?

I suspect you are handling the retrieved records in a less than optimal
manner as well. See
http://databases.aspfaq.com/database...getstring.html

Also, you should avoid using selstar (select *) in production code:
http://www.aspfaq.com/show.asp?id=2096

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cursorlocation issue shubha.sunkada@fds.com ASP General 0 06-05-2007 06:20 PM
Fill A VB6 Recordset Using The ASP Response Object Dan Sikorsky ASP General 0 04-10-2004 03:53 PM
using Command to set Parameters and Recordset to retrive the Query Bruno Alexandre ASP General 5 03-03-2004 04:41 PM
Obtaining autonumber value after using recordset AddNew Roger Withnell ASP General 9 12-02-2003 02:55 PM
RecordSet.Move or RecordSet.AbsolutePosition?? Hung Huynh ASP General 8 09-24-2003 11:07 AM



Advertisments