sh************@fds.com wrote:
Hi,
I have a recordset connection in asp that I am using to search
records.If I use the client side cursorlocation (rs.cursorlocation=3)
then it takes really long to return back the records due to which a
timeout occurs.If I change the cursorlocation to adUseNone(1) or
adUseServer(2) then the search is faster and without any problems.But
the sort on records cannot be done if I use adUseClient(3).I need to
have sort on these records.
Can somebody help me out.
Since you did not tell us what type of server-side cursor you are using
(forward-only, static, dynamic or keyset), I am going to assume it's the
default forward-only cursor. The reason the server-side cursor appears
to be faster is that ADO is only retrieving records from the server one
record at a time (the default CacheSize value is 1). the illusion of
speed you are seeing is simply that: an illusion. If you loop through
the recordset, you will see this for yourself. Looping through a
forward-only cursor will still be quicker than populating a client-side
static cursor.
The client-side cursor is a static cursor (you have no say in this: if a
client-side cursor is requested, you get a static cursor, regardless of
the cursor type you request). What happens with a client-side cursor is
that ADO uses a server-side firehose cursor to retrieve all the records
returned by your query and puts them into a static cursor supplied by
the ADO Cursor Library. This will take some time, especially if you are
retrieving a large number of records.
So, the conclusion is that your query is retrieving too many records,
leading to the timeout, and that you need to limit this in some way if
you need to use use the ADO Sort method. If you absolutely have to
retrieve such a large number of records, then you should consider using
a server-side cursor and allowing the database to sort the records
instead of ADO. Alternatively, you could increase the releant Timeout
properties, but this is not recommended in a web application.
PS. Using adUseNone causes ADO to default to adUseServer. You can view
the documentation here:
http://msdn.microsoft.com/library/en...ireference.asp
--
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.