下面的代码返回一个带有硬值编码的存储过程。我需要允许 74(@catcode in Stored Procedure) 更改为从组合框中选择的任何内容。任何帮助是极大的赞赏。我在 Access 中使用直通查询。
Private Sub ok_Click()
Dim objConnection As New ADODB.Connection
Dim objCom As ADODB.Command
Dim provStr As String
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=***;" & "Initial Catalog=***;User Id=***;Password=***;"
objConnection.Open provStr
With objCom
.ActiveConnection = objConnection
.CommandText = "dbo.ix_spc_planogram_match " & ("@catcode=") & Me.cat_code.Value
.CommandType = adCmdStoredProc
.Parameters.Refresh
.Parameters("@catcode").Value = me.cat_code.value
.Execute
End With
End Sub
存储过程:
execute dbo.ix_spc_planogram_match @catcode