Re: adUseClient and the command object

From: William Morris (news.remove.this.and.the.dots_at_seamlyne.com)
Date: 03/30/04


Date: Tue, 30 Mar 2004 10:41:53 -0600

A few more details: SQL Server 2000, OLEDB, Windows 2000. For the purposes
of this post, assume the query always returns records.

And to repeat the question, a little less ambiguously: Is there a way to get
where I want to go, which is to say, return a recordset I can page through
from query that could potentially run long, and do so allowing for a long
timeout?

"William Morris" <news.remove.this.and.the.dots@seamlyne.com> wrote in
message news:c4c7r3$2gn2j0$1@ID-205671.news.uni-berlin.de...
> I'm using a method for paging through results I got from
4GuysFromRolla.com,
> so:
>
> set rs = Server.CreateObject("ADODB.Recordset")
> 'Set the cursor location property
> rs.CursorLocation = adUseClient
> 'Set the cache size = to the # of records/page
> rs.CacheSize = NumPerPage
> rs.open sSQL, conn
> if rs.eof and rs.bof then
> response.write "&nbsp;<P><div align=""center""><span style='padding:
10px;
> border: 2px solid #ff0000;'>There are no vehicles in our inventory that
> match the criteria you entered.</span></div>"
> else
> rs.moveFirst
> m_totalRows = rs.recordcount
> rs.pageSize = NumPerPage
> m_TotalPages = rs.PageCount
> rs.AbsolutePage = m_currentPage
> outputArray = rs.GetRows
>
> It works very well as long as the query doesn't take so long that it times
> out, which it sometimes does. I tried using the command object along with
> the code above so I could specify a CommandTimeout, as in:
>
> set cmd = server.createobject("adodb.command")
> cmd.activeconnection = conn
> cmd.CommandText = sSQL
> cmd.commandTimeout = 120
>
> set rsResults = Server.CreateObject("ADODB.Recordset")
> 'Set the cursor location property
> rsResults.CursorLocation = adUseClient
> 'Set the cache size = to the # of records/page
> rsResults.CacheSize = NumPerPage
> set rsResults = cmd.execute
> rsResults.moveFirst
> m_totalRows = rsResults.recordCount
> rsResults.pageSize = NumPerPage
> m_totalPages = rsResults.pageCount
> m_currentPage = GetCurrentPageNumber
> rsResults.AbsolutePage = m_currentPage
> dim outputArray, tmpRowCounter
> tmpRowCounter = 1
> outputArray = rsResults.getRows
>
> ...but I get the following error: " Arguments are of the wrong type, are
out
> of acceptable range, or are in conflict with one another. " on this line:
>
> rsResults.AbsolutePage = m_currentPage
>
> Is there a way to get where I want to go, which is to say, run a long
query
> without timing out?
>
> --
> William Morris
> Semster, Seamlyne reProductions
> Visit our website, http://www.seamlyne.com, for the most comfortable
> historically inspired clothing you can buy!
>
>



Relevant Pages

  • Re: Provider error 80020005 Type mismatch.
    ... publications, and many publications could have numerous authors. ... congratulations for using a saved parameter query rather than ... Dim PIpk, varTitle, varCitation, varProdType, varYear, varReview, ... there is never a need to use an explicit Command object. ...
    (microsoft.public.data.ado)
  • Re: Inserting Records Into Access Table via DAO
    ... > I'm used to using the command object in ADO to insert records into an SQL ... Another way is to use the RunSQL command object. ... Dim iIntVal as integer ... The downside is that the query will not be optimized. ...
    (microsoft.public.access.modulesdaovba)
  • Re: Parameter Object really necessary?
    ... possible SQL injection attacks etc... ... you develop your query to include the parameters like this? ... Then run it through the command object? ... I'm still learning about .NET and it's one of those things that ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: UPDATE query in ASP.NET
    ... I don't see any association of your Command object to the Connection in your ... > Using Query Builder, I wrote a simple UPDATE query to update a single ... > Query Builder in a OleDbCommand object by right-clicking the mouse. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: cant get query to run over ADO, but works fine in Access interfac
    ... If an SQL statement runs in Query Analyzer (or some other interface), ... should be able to execute it using an ADO Command object. ...
    (microsoft.public.data.ado)