Command object and recordset

Results 1 to 2 of 2

Thread: Command object and recordset

  1. #1
    Join Date
    Dec 1969

    Default Command object and recordset

    I am tryig to page the recordset returned by command object that runs stored procedure on my sql server. It gives me error. Is this even possible? Using command object and recordset methods together?<BR>Any help...<BR><BR>Thanks

  2. #2
    Join Date
    Dec 1969

    Default RE: Command object and recordset

    it&#039s possible but not necessary.<BR><BR>you can run your stored procedure like this:<BR><BR>strSQL="EXECUTE sp_MyStoredProc"<BR>Set objRS=objConn.Execute(strSQL)<BR><BR>if you need to pass params to the stored proc:<BR>strSQL="EXECUTE sp_MyStoredProc @TextParam=&#039" & strText & ", " &_<BR>" @NumParam=" & intNumber<BR>Set objRS=objConn.Execute(strSQL)<BR><BR>If the SP doesn&#039t return a resocrdset:<BR>strSQL="EXECUTE sp_MyStoredProc @TextParam=&#039" & strText & ", " &_<BR>" @NumParam=" & intNumber<BR>objCon.Execute strSQL<BR><BR>If the SP returns multiple recordsets:<BR>strSQL="EXECUTE sp_MyStoredProc @TextParam=&#039" & strText & ", " &_<BR>" @NumParam=" & intNumber<BR>Set objRS=objConn.Execute(strSQL)<BR>&#039 do stuff with your first RS<BR>objRS.NextRecordSet<BR>&#039 do stuff with your second RS<BR>objRS.NextRecordSet<BR>&#039 et cetera, et cetera...<BR><BR><BR>Using the command object is innefficient for several reasons: it adds more code to your apps, making them harder to read and harder to debug, and it means you use one more object than you need every time you use the command object.<BR><BR>i&#039d junk it altlgether, if i were you.

Posting Permissions

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