Can we open command object recordset in adopensta

Results 1 to 2 of 2

Thread: Can we open command object recordset in adopensta

  1. #1
    Gabriel Kardos Guest

    Default Can we open command object recordset in adopensta

    Hi,<BR><BR>I am doing the paging of the recordset. but in paging the cursor type of recordset to be open must be in static mode (adopenstatic).since i am using command object for retreiving data from the table using stored procedure.<BR><BR>The code which i written is below. I want to display 10 records per page.<BR><BR>set mycommand=server.CreateObject("Adodb.command")<BR> set mycommand.ActiveConnection=myconn<BR>mycommand.Com mandType=adcmdstoredproc<BR>mycommand.CommandText= "project_proc"<BR>set param=mycommand.CreateParameter("@start_dt",adVarC har,adParamInput,20,enddate)<BR>mycommand.Paramete rs.Append param <BR>set param=mycommand.CreateParameter("@end_dt",adVarCha r,adParamInput,20,startdate)<BR>mycommand.Paramete rs.Append param <BR>set objrs=mycommand.Execute()<BR><BR>Response.Write("p agecount= "&objrs.PageCount)<BR><BR>--objrs.AbsolutePage = session("currentpage")<BR>.......<BR><BR>it gives me output "pagecount=-1"<BR><BR>Can u tell me the solution for this problem.<BR><BR>if i open the recordset using sql i.e.<BR> "sqlquery",myconn,adopenstatic<BR>then it gives me correct answer but i want to do as above.<BR><BR>please give me answer.<BR>Thanks<BR><BR> <BR><BR>gabriel<BR><B R>or<BR>

  2. #2 Guest

    Default RE: Can we open command object recordset in adope

    Your observations are correct. You need to pass a string query, if you want to use paging properties of ADO.Recordset.<BR>When you execute a stored procedure, which a is nothing more but compiled T-SQL, SQL-server implements forward-only cursor.<BR>If you really need to use a proc, look for an article "paging through recordset"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts