473,785 Members | 2,842 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem using cursorlocation for recordset

Hi,

I have a recordset connection in asp that I am using to search
records.If I use the client side cursorlocation (rs.cursorlocat ion=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.

Thanks

Jun 5 '07 #1
10 9221
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.cursorlocat ion=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.
Jun 5 '07 #2
On Jun 5, 10:05 am, "Bob Barrows [MVP]" <reb01...@NOyah oo.SPAMcom>
wrote:
shubha.sunk...@ 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.cursorlocat ion=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...cadoapireferen...
--
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.
Hi,
I am using a dynamic server side cursor.Also my result set is not
huge ..just 80 records.One more thing that is wierd is that the result
set comes back instantly for the first search,but takes forever when
searched again for the same criteria.Eveyti me I logout and login and
do the search for the 1st time the search is quick and takes forever
for consequnt searches.

Thanks

Jun 5 '07 #3
sh************@ fds.com wrote:
On Jun 5, 10:05 am, "Bob Barrows [MVP]" <reb01...@NOyah oo.SPAMcom>
wrote:
Hi,
I am using a dynamic server side cursor.
Why? Are you planning to be connected long enough for it to matter what
other users do? If so, you should probably rethink this. With ASP, the
idea should be to get in, get your data, and get out as quickly as
possible. Dynamic cursors aren't really suited for that goal.
Also my result set is not
huge ..just 80 records.
??? Well, there goes my theory. I would not expect there to be a
difference between a server-side and client-side cursor with only 80
records.
One more thing that is wierd is that the result
set comes back instantly for the first search,but takes forever when
searched again for the same criteria.Eveyti me I logout and login and
do the search for the 1st time the search is quick and takes forever
for consequnt searches.
Without being able to reproduce your problem I am at a loss.
Try using SQL Profiler to see what is happening behind the scenes. Oh
wait, you never identified your database type and version. I don't know
why i assumed SQL Server.

--
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.
Jun 5 '07 #4
On Jun 5, 2:13 pm, "Bob Barrows [MVP]" <reb01...@NOyah oo.SPAMcom>
wrote:
shubha.sunk...@ fds.com wrote:
On Jun 5, 10:05 am, "Bob Barrows [MVP]" <reb01...@NOyah oo.SPAMcom>
wrote:
Hi,
I am using a dynamic server side cursor.

Why? Are you planning to be connected long enough for it to matter what
other users do? If so, you should probably rethink this. With ASP, the
idea should be to get in, get your data, and get out as quickly as
possible. Dynamic cursors aren't really suited for that goal.
Also my result set is not
huge ..just 80 records.

??? Well, there goes my theory. I would not expect there to be a
difference between a server-side and client-side cursor with only 80
records.
One more thing that is wierd is that the result
set comes back instantly for the first search,but takes forever when
searched again for the same criteria.Eveyti me I logout and login and
do the search for the 1st time the search is quick and takes forever
for consequnt searches.

Without being able to reproduce your problem I am at a loss.
Try using SQL Profiler to see what is happening behind the scenes. Oh
wait, you never identified your database type and version. I don't know
why i assumed SQL Server.

--
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.
Thanks Bob.
I am using SQL Server and will try using the profiler.
About the time for searching using client side and server side as I
said I am not particular about using either.But the problem is I
cannot sort if using client side.

Jun 5 '07 #5
sh************@ fds.com wrote:
>
Thanks Bob.
I am using SQL Server
What version?
and will try using the profiler.
About the time for searching using client side and server side as I
said I am not particular about using either.But the problem is I
cannot sort if using client side.
Why not? If anything, I would have thought you might have a problem with
Sort when using a server-side cursor ...

Let's get this out of the way. What problem are you having using Sort?
And why can't you use an Order By clause to allow the database to sort
your records? My preference would be to use a default server-side
forward-only cursor unless extra functionality is needed

You are going to have to start posting some relevant code (no html
please - just the vbscript code to allow us to see what you are doing).
It is impossible to help while in the dark like this.

http://www.aspfaq.com/5006

--
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.
Jun 5 '07 #6
sh************@ fds.com wrote:
Thanks Bob.
I am using SQL Server and will try using the profiler.
About the time for searching using client side and server side as I
said I am not particular about using either.But the problem is I
cannot sort if using client side.
I've just looked at the documentation and I am baffled. From the
documentation for the Sort property:

This property requires the CursorLocation property to be set to
adUseClient.

So you should not have any problem sorting with a clientside cursor ...
--
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.
Jun 5 '07 #7
On Jun 5, 4:13 pm, "Bob Barrows [MVP]" <reb01...@NOyah oo.SPAMcom>
wrote:
shubha.sunk...@ fds.com wrote:
Thanks Bob.
I am using SQL Server and will try using the profiler.
About the time for searching using client side and server side as I
said I am not particular about using either.But the problem is I
cannot sort if using client side.

I've just looked at the documentation and I am baffled. From the
documentation for the Sort property:

This property requires the CursorLocation property to be set to
adUseClient.

So you should not have any problem sorting with a clientside cursor ...
--
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.
When I say sort I do not just need the records in sort order but
should be able to let user sort dynamically.The user should be able to
point to any of the fields in result set and sort in ascending or
descending order.When I use client side cursor it is possible but not
server side.
Everything works fine when I use client side cursor except that after
the first search it keeps searching and never returns.

Jun 5 '07 #8
sh************@ fds.com wrote:
On Jun 5, 4:13 pm, "Bob Barrows [MVP]" <reb01...@NOyah oo.SPAMcom>
wrote:
>shubha.sunk... @fds.com wrote:
>>Thanks Bob.
I am using SQL Server and will try using the profiler.
About the time for searching using client side and server side as I
said I am not particular about using either.But the problem is I
cannot sort if using client side.

I've just looked at the documentation and I am baffled. From the
documentatio n for the Sort property:

This property requires the CursorLocation property to be set to
adUseClient.

So you should not have any problem sorting with a clientside cursor
>
When I say sort I do not just need the records in sort order but
should be able to let user sort dynamically.The user should be able to
point to any of the fields in result set .
Um, the user is not clicking on your recordset. he is clicking on an
html element that you generated using data in a recordset which is no
longer in existence. I assume the user's click is causing a post back to
your asp page in which you open a new recordset based on what the user
clicked.

Is that a fair description?
and sort in ascending or
descending order.
So modify the Order By clause in the sql used to retrieve the records
based on what the user clicked. I still see no need to use the Sort
property of the recordset.
>When I use client side cursor it is possible but not
server side.
Well now you are saying the reverse of what you said earlier.

In your first post you said "But the sort on records cannot be done if I
use adUseClient(3). " (I should have questioned this statement at this
point)
In your second post you said " ... cannot sort if using client side."
And now you say : "When I use client side cursor it is possible but not
server side."

Everything works fine when I use client side cursor except that after
the first search it keeps searching and never returns.
And I keep saying, without seeing some code to see what you are doing,
we cannot help.

--
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.
Jun 5 '07 #9
On Jun 5, 6:10 pm, "Bob Barrows [MVP]" <reb01...@NOyah oo.SPAMcom>
wrote:
shubha.sunk...@ fds.com wrote:
On Jun 5, 4:13 pm, "Bob Barrows [MVP]" <reb01...@NOyah oo.SPAMcom>
wrote:
shubha.sunk...@ fds.com wrote:
Thanks Bob.
I am using SQL Server and will try using the profiler.
About the time for searching using client side and server side as I
said I am not particular about using either.But the problem is I
cannot sort if using client side.
I've just looked at the documentation and I am baffled. From the
documentation for the Sort property:
This property requires the CursorLocation property to be set to
adUseClient.
So you should not have any problem sorting with a clientside cursor
When I say sort I do not just need the records in sort order but
should be able to let user sort dynamically.The user should be able to
point to any of the fields in result set .

Um, the user is not clicking on your recordset. he is clicking on an
html element that you generated using data in a recordset which is no
longer in existence. I assume the user's click is causing a post back to
your asp page in which you open a new recordset based on what the user
clicked.

Is that a fair description?
and sort in ascending or
descending order.

So modify the Order By clause in the sql used to retrieve the records
based on what the user clicked. I still see no need to use the Sort
property of the recordset.
When I use client side cursor it is possible but not
server side.

Well now you are saying the reverse of what you said earlier.

In your first post you said "But the sort on records cannot be done if I
use adUseClient(3). " (I should have questioned this statement at this
point)
In your second post you said " ... cannot sort if using client side."
And now you say : "When I use client side cursor it is possible but not
server side."
Everything works fine when I use client side cursor except that after
the first search it keeps searching and never returns.

And I keep saying, without seeing some code to see what you are doing,
we cannot help.

--
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.- Hide quoted text -

- Show quoted text -
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")
Set rs = Server.CreateOb ject("ADODB.Rec ordset")
rs.CursorLocati on = 3
SQLText = "select * from CaseData"
rs.Open SQLText, Connection,1,3

Thanks

Jun 6 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2906
by: André Gasser | last post by:
hello newsgroup, I just discovered a weird effect in my php code. here is the flow of my code: 1. upload jepg file to server 2. create new (empty) jpeg file using imagecreatefromjpeg() function 3. use imagecopyresampled to resize src image and store in newly created image from step 2.
4
4463
by: bmiras | last post by:
I've got a problem using urllib2 to get a web page. I'm going through a proxy using user/password authentification and i'm trying to get a page asking for a HTTP authentification. And I'm using python 2.3 Here is an exemple of the piece of code I use: import urllib2 #Proxy handler proxy_handler = urllib2.ProxyHandler({"http" :
4
6041
by: Derek Timothy | last post by:
Hi folks I have strange problem using cmd.exe from asp code I am trying to save the results of an FTP command into a text file. When I run this command from the command line of the web server it creates the text file OK and it contains the results of the FTP commands. ftp.exe -s:test.ftp > c:\tempfile.txt However when I run it from asp using cmd.exe, it creates the file c:\tempfile.txt but there is nothing in it.
3
2707
by: Jacky Zhu | last post by:
Hi all, I am having a problem trying to consume a webservice that is developed on ..Net. I can access it without any problem using a .net client, but when I use a java client (based on Axis 1.1), some methods work, some don't. The error message I got is "org.apache.axis.types.URI$MalformedURIException: No scheme found in URI..."
4
6348
by: Dani | last post by:
Hi everyone Description of the problem: Using a PreparedStatement to write down an integer (int) plus a timestamp for testing purposes. When read out again the integer looks very different. We found that it was shifted three Bytes to the left, i.e. 4 becomes hex 4000000 which is 67108864 in decimal base. This means that the value written and the value read sometimes do not match, which is of course inacceptable for all real world...
2
9245
by: Kent Lewandowski | last post by:
hi all, Recently I wrote some stored procedures using java jdbc code (admittedly my first stab) and then tried to implement the same within java packages (for code reuse). I encountered problems doing this. I wanted to implemented a generic "Helper" class like this: /** * Helper
3
1961
by: Franky | last post by:
Been having a problem using a treeview. Work great the first time the form containing it is entered but not the second time. Took a while to create a small sample that exhibits the problem, but here it is. Seems to have something to do with doing ShowDialog Easy to reproduce this project, simply add two forms.
2
1765
dnb
by: dnb | last post by:
how can we fill data in same mshflexgrid using two recordset? Some from one & some from another recordset? please give reply
3
2236
by: presencia | last post by:
Hi all, I have a problem using gdb. I am using Eclipse-CDT as a frontend, but since this problem is obviously related to the gcc compiler or the gdb itself, I have reproduced it without Eclipse. Sample Program This small program should suffice to show my problem. I have saved this file as "main.cpp". #include<vector> #include <iostream> struct I{
0
9645
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
10092
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9950
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7499
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5381
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4053
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3647
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2879
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.