sh************@ fds.com 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("Connec tionname")
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.CreateOb ject("ADODB.Rec ordset")
rs.CursorLocati on = 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.