0

下面的代码返回一个带有硬值编码的存储过程。我需要允许 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
4

1 回答 1

0

我想你的意思是在这些方面:

.CommandText = "dbo.ix_spc_planogram_match " &  me.cat_code
.CommandType = adCmdStoredProc
.cmd.Parameters("@catcode") =  me.cat_code

.Execute

这是假设组合的绑定列包含所需的值。

于 2012-07-12T15:46:20.313 回答