Exec SP with Cursors using ADO
From: rikesh patel (trikky_at_rukp28.freeserve.co.uk)
Date: 02/16/05
- Next message: MikeD: "Re: Exec SP with Cursors using ADO"
- Previous message: Maury Markowitz: "Re: VB newbie - exposing VB subs to VBA?"
- Next in thread: MikeD: "Re: Exec SP with Cursors using ADO"
- Reply: MikeD: "Re: Exec SP with Cursors using ADO"
- Messages sorted by: [ date ] [ thread ]
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)
- Next message: MikeD: "Re: Exec SP with Cursors using ADO"
- Previous message: Maury Markowitz: "Re: VB newbie - exposing VB subs to VBA?"
- Next in thread: MikeD: "Re: Exec SP with Cursors using ADO"
- Reply: MikeD: "Re: Exec SP with Cursors using ADO"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|