|
-
April 30th, 2001, 04:45 AM
#1
Running Stored Procedure
Hello
I want to know how can I run a sql server stored procedure from my program written in VB
Thannks
Ehsan
-
April 30th, 2001, 08:00 AM
#2
Re: Running Stored Procedure
Dim cnn as ADODB.Connection
Dim rst as ADODB.Recordset
set cnn = new ADODB.Connection
set rst = new ADODB.Recordset
cnn.ConnectionString = "Your Connection string"
cnn.Open
'for a stored procedure which doesn't return any records
cnn.Execute "sp_MyStoredProcedure 'Param1',2"
'to return records use either:
set rst = cnn.Execute ("sp_MyStoredProcedure 'Param1',2)
'Or
rst.Open "Execute sp_MyStoredProcedure 'Param1',2",cnn,adOpenStatic,adLockOptimistic
rst.Close
set rst = nothing
cnn.Close
set cnn = nothing
TimCottee
I know a little about a lot of things and a lot about very little.
Brainbench MVP For Visual Basic
http://www.brainbench.com
MCP, MCSD, MCDBA, CPIM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|