1

我正在尝试单击“确定”按钮运行以下存储过程:

Private Sub ok_Click()

Dim objConnection As New ADODB.Connection
Dim objCom As ADODB.Command
Dim provStr As String

Set objCom = New ADODB.Command

objConnection.Provider = "sqloledb"
provStr = "Data Source=Server Name;" & "Initial Catalog=DB NAME;User Id=USERNAME;Password=Password;"

objConnection.Open provStr

With objCom
    .ActiveConnection = objConnection
    .CommandText = "dbo.ix_spc_planogram_match 74"
    .CommandType = adCmdStoredProc
    .Execute
End With

End Sub

错误是:未定义用户类型。存储过程在 SQL Server Management Studio 中正确运行。

4

1 回答 1

1

检查您的引用,特别是确保您引用的是 Microsoft ActiveX 数据对象 xx 库。

于 2012-07-10T19:07:43.923 回答