Tuesday, March 27, 2012

Calling Stored proc in ActiveX script

Hi!
How do you call a store procedure in an ActiveX script? I have a stored procedure that I want to execute everytime my Data Driven Query tasks inserts a new record.
Thanks.Dim oConn
Dim oComm

Set oConn = CreateObject("ADODB.Connection")
Set oComm = CreateObject("ADODB.Command")

oConn.ConnectionString = sConnectionString
oConn.Open

oComm.CommandText = "myStoredProc"
oComm.CommandType = 4 ' adStoredProc
oComm.Parameters.Refresh
oComm.Parameters("myParam") = "This"
oComm.ActiveConnection = oConn

oComm.Execute

(alternatively)

Set oRS = oComm.Execute

Written from the top of my head. Your mileage may very. Check syntax carefully. Never run while carrying scissors by the handle. Always keep your barrel pointed downrange.

Regards,

hmscott|||thanks for the advice!

No comments:

Post a Comment