PDA

Click to See Complete Forum and Search --> : Execute


Zach Ahmed
May 28th, 2004, 03:25 PM
HI All:
I have a stored procedure on mys sqlserver. The name of the sp is deletedata. How can I execute this sp from vb and pass it the record id? In vfp I use to execute the sp by using the following code:

sqlcmd = 'EXECUTE[CLEAR_EDIFILE] ' + ALLTRIM(edifile)
jtq = SQLEXEC(cn, sqlcmd)

Need to do the same in vb.

Thanks

Jamo
May 29th, 2004, 12:40 PM
I hope that following will help you with executing your procedure.

Dim adoConn As New ADODB.Connection
adoConn.Open sConnect

Dim adoSPw As New ADODB.Command

adoSPw.ActiveConnection = adoConn
adoSPw.CommandText = "own_procedure"
adoSPw.CommandType = adCmdStoredProc

adoSPw.Parameters(1).Value = input_value

adoSPw.Execute

outPut_value = adoSPw.Parameters(2).Value

RobDog888
May 29th, 2004, 04:57 PM
You may want to try posting a link to this thread in the
Databases or Classic VB forums. This forum is just for VBA.

:)

Zach Ahmed
Jun 1st, 2004, 07:29 AM
Thanks