使用游标位置记录集的问题 [英] Problem using cursorlocation for recordset

查看:66
本文介绍了使用游标位置记录集的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我在asp中有一个记录集连接,用于搜索

记录。如果我使用客户端游标位置(rs。 cursorlocation = 3)

然后返回记录需要很长时间才会发生

超时。如果我将光标位置更改为adUseNone(1)或

adUseServer(2)然后搜索速度更快,没有任何问题。但是如果我使用adUseClient(3),则无法完成记录排序。我需要

对这些记录进行排序。


有人可以帮帮我吗。


谢谢

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.

Thanks

推荐答案

sh ****** ******@fds.com 写道:




我有一个记录集在我用来搜索的连接

records.If我使用客户端游标位置(rs.cursorlocation = 3)

然后返回bac需要很长时间k由于发生

超时而发生的记录。如果我将光标位置更改为adUseNone(1)或

adUseServer(2),那么搜索速度更快,没有任何问题。但是

如果我使用adUseClient(3),记录的排序就无法完成。我需要

对这些记录进行排序。


有人可以帮帮我。
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.



因为你没告诉我们你使用的是什么类型的服务器端游标

(仅向前,静态,动态或键集),我将假设它是

默认的仅向前游标。服务器端游标出现更快的原因是,ADO只能从服务器一次检索一条记录(默认的CacheSize值为1) 。

速度的错觉你所看到的只是:幻觉。如果您通过

记录集循环,您将自己看到这一点。循环使用

仅前向光标仍然比填充客户端

静态光标更快。


客户端-side cursor是一个静态游标(你在这里没有发言权:如果要求一个
客户端游标,你得到一个静态游标,无论

游标输入你的要求)。客户端游标会发生什么?
ADO使用服务器端firehose游标来检索查询返回的所有记录

并将它们放入静态游标由

提供的ADO游标库。这需要一些时间,特别是如果你是检索大量记录的话。


所以,结论是你的查询检索的记录太多了,

导致超时,并且如果需要使用ADO Sort方法需要使用

,则需要以某种方式对此进行限制。如果你绝对需要

检索如此大量的记录,那么你应该考虑使用

a服务器端游标并允许数据库对记录进行排序

而不是ADO。或者,您可以增加释放超时

属性,但不建议在Web应用程序中使用。


PS。使用adUseNone会导致ADO默认为adUseServer。您可以在此处查看

文档:
http://msdn.microsoft.com/library/en...ireference.asp

-

Microsoft MVP - ASP / ASP.NET

请回复新闻组。我的From

标题中列出的电子邮件帐户是我的垃圾邮件陷阱,因此我不经常检查它。通过发布到新闻组,您将获得更快的回复。

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.


6月5日上午10点05分,Bob Barrows [MVP] ]" < reb01 ... @ NOyahoo.SPAMcom>

写道:
On Jun 5, 10:05 am, "Bob Barrows [MVP]" <reb01...@NOyahoo.SPAMcom>
wrote:

shubha.sunk ... @ fds.com写道:
shubha.sunk...@fds.com wrote:


Hi,


我在asp中有一个用于搜索的记录集连接

记录。如果我使用客户端游标位置(rs.cursorlocation = 3)

那么返回记录需要很长时间才能获得

超时发生。如果我将光标位置更改为adUseNone(1)或

adUseServer(2),则搜索更快且没有任何问题。但是

如果我使用adUseClient(3),则无法对记录进行排序。我需要

对这些记录进行排序。
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.



因为您没有告诉我们您使用的是哪种类型的服务器端游标

(仅向前,静态,动态或键集) ),我将假设它是

默认的仅向前游标。服务器端游标出现更快的原因是,ADO只能从服务器一次检索一条记录(默认的CacheSize值为1) 。

速度的错觉你所看到的只是:幻觉。如果您通过

记录集循环,您将自己看到这一点。循环使用

仅前向光标仍然比填充客户端

静态光标更快。


客户端-side cursor是一个静态游标(你在这里没有发言权:如果要求一个
客户端游标,你得到一个静态游标,无论

游标输入你的要求)。客户端游标会发生什么?
ADO使用服务器端firehose游标来检索查询返回的所有记录

并将它们放入静态游标由

提供的ADO游标库。这需要一些时间,特别是如果你是检索大量记录的话。


所以,结论是你的查询检索的记录太多了,

导致超时,并且如果需要使用ADO Sort方法需要使用

,则需要以某种方式对此进行限制。如果你绝对需要

检索如此大量的记录,那么你应该考虑使用

a服务器端游标并允许数据库对记录进行排序

而不是ADO。或者,您可以增加释放超时

属性,但不建议在Web应用程序中使用。


PS。使用adUseNone会导致ADO默认为adUseServer。您可以在此处查看

文档: http://msdn.microsoft.com/library/en...cadoapireferen ...

-

Microsoft MVP - ASP /ASP.NET

请回复新闻组。我的From

标题中列出的电子邮件帐户是我的垃圾邮件陷阱,因此我不经常检查它。通过发布到新闻组,您将获得更快的回复


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.





我正在使用动态服务器端游标。我的结果集也不是

巨大..只有80个记录。更奇怪的是,结果

设置立即回来进行第一次搜索,但是当

再次搜索相同时criteria.Eveytime我退出并登录和

搜索第一次快速搜索并且需要永远

进行连续搜索。


谢谢

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.Eveytime I logout and login and
do the search for the 1st time the search is quick and takes forever
for consequnt searches.

Thanks


sh************@fds.com 写道:

6月5日上午10点05分, Bob Barrows [MVP]" < reb01 ... @ NOyahoo.SPAMcom>

写道:



我正在使用动态服务器端游标。
On Jun 5, 10:05 am, "Bob Barrows [MVP]" <reb01...@NOyahoo.SPAMcom>
wrote:
Hi,
I am using a dynamic server side cursor.



为什么?您是否计划连接足够长的时间以确定其他用户的工作是什么?如果是这样,你应该重新考虑一下。使用ASP,

的想法应该是进入,获取您的数据,并尽可能快地退出
。动态游标并不适合这个目标。

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.


另外我的结果集不是

巨大..只有80条记录。
Also my result set is not
huge ..just 80 records.



???那么,我的理论就是这样。我不希望服务器端和客户端游标之间只有80

记录存在

差异。

??? 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.


还有一件事很奇怪,结果

设置会在第一次搜索时立即返回,但是当

再次搜索时,它会永远消失criteria.Eveytime我退出并登录和

搜索第一次搜索很快并且需要永远

才能进行连续搜索。
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.Eveytime I logout and login and
do the search for the 1st time the search is quick and takes forever
for consequnt searches.



如果无法重现您的问题,我将无所适从。

尝试使用SQL事件探查器查看幕后发生的事情。哦

等等,你从未确定过你的数据库类型和版本。我不知道为什么我会假设SQL Server。


-

Microsoft MVP - ASP / ASP。 NET

请回复新闻组。我的From

标题中列出的电子邮件帐户是我的垃圾邮件陷阱,因此我不经常检查它。通过发布到新闻组,您将获得更快的回复。

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.


这篇关于使用游标位置记录集的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆