|
-
Hi
I Assume your stored procedure has been created sucessfully.
Below is a simple way to call stored procedure from VB
Dim comm As ADODB.Command
dim conn as ADODB.Connectin
set comm = new adodb.command
set conn = new adodb.connection
conn.open "username","password","host_string"
comm.activeconnection = conn
comm.CommandText = " {call Procedurename (?,?,?,?) }"
the ???? are the number of parameters to the procedure .
comm.Parameters(0) = value1
comm.Parameters(1) = value2
comm.Parameters(2) = value3
comm.Parameters(3) = value4
comm.Execute
set comm = nothing
conn.close
set conn = nothing
another way to do it is
Dim comm As ADODB.Command
Dim conn as ADODB.Connectin
Dim param as ADODB.Parameter
set comm = new adodb.command
set conn = new adodb.connection
conn.open "username","password","host_string"
comm.activeconnection = conn
comm.CommandType = adCmdText
comm.CommandText = "{CALL procedurename (?)}"
Set param = comm.CreateParameter("name", adVarChar, adParamInput, Len(variable), actual value)
comm.Parameters.Append param
comm.Execute
set comm = nothing
conn.close
set conn = nothing
The second way is the pro way to do it . It gives more control on the code .
Hope this helps
Happy Programming
Regards
Shailesh
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
|