Re: adUseClient and the command object

From: Val Mazur (group51a_at_hotmail.com)
Date: 03/31/04


Date: Tue, 30 Mar 2004 21:24:02 -0500

Hi William,

I think what happened in your case is that paging is not supported by the
provider on a server side.
When you open your recordset using Command, even if you specify
CursorLocation property of the recordset to adUseClient, ADO command will
inherit CursorLocation property of ADO connection, not the recordset. To
open your recordset on a client side, set CursorLocation property of the
Connection to adUseClient.

-- 
Val Mazur
Microsoft MVP
"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: How to fill a Client Side Recorset with a command (sp exec)
    ... To be able to open recordset on a client side using Command, ... CursorLocation property of the Connection to adUseClient ... > command from a connection, but i´m having problems with the parameters. ...
    (microsoft.public.data.ado)
  • Re: More ASP.Net Newbie Questions
    ... The Command is then what you're doing with this connection, ... In regards to your final point, making grids and controls in general do ... > Connection and Recordset objects into, like, 37 different things. ...
    (microsoft.public.dotnet.framework.aspnet)
  • RE: Beginners explanation for API Dialog Box Code?
    ... I am getting the name of a file I want to copy a recordset ... 'Set filter to show only xls Spreadsheets ... If varGetSaveName = "" Then ... The code examples above go in the Click Event of the command button you will ...
    (microsoft.public.access.formscoding)
  • Re: Recordset Closed After Having Just Being Opened
    ... by 'pass the command object to a recordset as the source parameter'. ... You must set the command.ActiveConnection to an already-opened connection ...
    (microsoft.public.vb.database.ado)
  • Re: insert Q
    ... Use an explicit Connection object/ ... When you use a connection's Execute method, a Command object is ... Always use an explicit recordset object: ... A Connection object implements the connection to the database. ...
    (microsoft.public.inetserver.asp.db)