你可以先连接 public cnn as adodb.connection set cnn as new adodb.connection cnn.open "连接字符串" 然后用连接来执行你的存储过程 cnn.execute "your proc name" if error.count <> 0 then 'err msg else 'go on end if error.clear
Dim rcPC As New ADODB.Command Dim strResult as String rcPC.ActiveConnection = oConn rcPC.CommandType = adCmdStoredProc rcPC.CommandText = "plancntr" With rcPC .Parameters("@cntrid") = txtCntrid.Text .Parameters("@selectid") = lSelectid .Parameters("@carid") = txtCarid.Text & "" .Parameters("@eir") = txtEIR.Text & "" .Parameters("@closeno") = txtCloseNo.Text & "" .Parameters("@proposer") = lUser.UserID .Execute strResult=.Parameters("@Result") '返回结果 End With Set rcPC=nothing
能举上一两个例子么?
public cnn as adodb.connection
set cnn as new adodb.connection
cnn.open "连接字符串"
然后用连接来执行你的存储过程
cnn.execute "your proc name"
if error.count <> 0 then
'err msg
else
'go on
end if
error.clear
Dim strResult as String
rcPC.ActiveConnection = oConn
rcPC.CommandType = adCmdStoredProc
rcPC.CommandText = "plancntr"
With rcPC
.Parameters("@cntrid") = txtCntrid.Text
.Parameters("@selectid") = lSelectid
.Parameters("@carid") = txtCarid.Text & ""
.Parameters("@eir") = txtEIR.Text & ""
.Parameters("@closeno") = txtCloseNo.Text & ""
.Parameters("@proposer") = lUser.UserID
.Execute
strResult=.Parameters("@Result") '返回结果
End With
Set rcPC=nothing