Exec SP with Cursors using ADO

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: rikesh patel (trikky_at_rukp28.freeserve.co.uk)
Date: 02/16/05


Date: Wed, 16 Feb 2005 22:56:40 -0000

Hi

I am trying to execute an SP which contains cursors etc....but when I create
the RS using ADO, I seem to get an error?

Is there something wrong with executing SP's of this type through VB using
ADO?

Below is a sample of the code I use:

'**************************************************
Set mrsRpt = New ADODB.Recordset
Set cmd1 = New ADODB.Command
Set cnn1 = New ADODB.Connection

 sconnect = "Provider=SQLOLEDB.1;Password = " & mstrPassword & _
          ";Persist Security Info=True;User ID= " & mstrUser & _
            ";Initial Catalog=" & mstrDatabase & ";Data Source=" &
mstrServer

   'Creates Connection information (NOTE: Server-Side cursor much faster.
  With cnn1
    .CursorLocation = adUseServer
    .CommandTimeout = 0
    .Open sconnect

  End With

  'Creates Command information
  With cmd1
    .ActiveConnection = cnn1
    .CommandText = "exec " & txtSPName & " " & txtParam
    .CommandType = adCmdText
    .CommandTimeout = 0
  End With

  mrsRpt.Open cmd1.CommandText, cnn1, adOpenDynamic, adLockBatchOptimistic
'**************************************************

Kind Regards

Rikesh
(VB6 SP5)



Relevant Pages

  • Re: Exec SP with Cursors using ADO
    ... > I am trying to execute an SP which contains cursors etc....but when I ... > the RS using ADO, I seem to get an error? ... gaining ANYTHING using the Command object as you are. ...
    (microsoft.public.vb.com)
  • Cursors with ADO
    ... I am trying to execute an SP which contains cursors etc....but when I create ... the RS using ADO, I seem to get an error? ... 'Creates Command information ...
    (microsoft.public.vb.database.ado)
  • Perl Error
    ... I am trying to execute a procedure in perlscript from MSSQL server database.I am using CYGWIN console for executing the perl script. ... The DBI 1.28 is being used with perl5.8.7 here.s ... Is it that some truncation is happening as the cursors are fetching around 1-2 lakhs of rows sometimes. ...
    (perl.dbi.users)
  • Re: trigger- problem: too many open cursors
    ... cursors are explicit cursors you've coded. ... Oracle can open additional ... execute an update on this Table Table1, ...
    (comp.databases.oracle.misc)