存储过程已经编写好,但是在VB中我们需要什么控件与代码来实现他呢?

2024-12-31 01:57:37
推荐回答(1个)
回答1:

定义adodb.command对象调用存储过程,如果存储过程中参数,还需要定义adoDB,parameter对象。例如:
Dim cmd As ADODB.Command
Dim strResult As ADODB.Parameter

Set cmd = New ADODB.Command

cmd.ActiveConnection = g_ADOConn

cmd.CommandType = adCmdStoredProc
cmd.CommandText = "存储过程名"

cmd.Parameters.Append cmd.CreateParameter("输入参数1", adVarChar, adParamInput, 16, “值1”)
cmd.Parameters.Append cmd.CreateParameter("输入参数2", adVarChar, adParamInput,16, “值2”)

cmd.Execute