求助:调用带参数的存储过程
sql = "EXEC P_TEST " & Me.Combo0
Connection.Open "Provider=sqloledb;Data Source=ZHANGHA;Initial Catalog=mrpdata;User Id=sa;Password=;"
RS.CursorLocation = adUseClient
RS.Open sql, Conn, adOpenKeyset, adLockOptimistic
If Not RS.EOF Then Set FrmWarehouseStock.Form.Recordset = RS
RS.Close
Conn.Close
调用后查询不到结果,求助,我这样传递参数正确吗?Me.Combo0是窗体上一个组合框,以下是我SQLSERVER里的存储过程
create proc P_TEST @TxtIntoW varchar(20)
as
SELECT * FROM tabAccountlistA AS A
WHERE A.Fpass=1 And A.FfatherOddnumber=@TxtIntoW
GO
在此先谢谢各位了
------解决方案--------------------参数两端拼接一组单引号
sql = "EXEC P_TEST '" & Me.Combo0 & "'"