# 请问ADO物件如何传参数给stored procedures

Posted by Joint on October 21, 1999 at 17:55:16:

我在资料库里有一个stored procedures ,myproc1
里有二个变数@aa,@bb (char)
我在Query Analyzer中带参数执行无误,
可是我在VB程式中

Private Sub Command1_Click()
Dim db As Connection
Dim cmd As New ADODB.Command
Set db = New Connection
Dim Parm As New Parameter
Dim Parm2 As New Parameter
Parm = "AAA"
Parm2 = "BBB"
db.CursorLocation = adUseClient
db.Open "PROVIDER=MSDASQL;dsn=GDMS_sql;uid=sa;pwd=;"
Set cmd.ActiveConnection = db
Set adoPrimaryRS = New Recordset
cmd.CommandType = adCmdStoredProc
cmd.CommandText = "{call myproc1 ?,?}"
Set adoPrimaryRS = cmd.Execute(parm,parm2)
Set grdDataGrid.DataSource = adoPrimaryRS

End Sub

为什么不行都发生错误??在cmd.Excute那一行说我的Sql语有误.
拜托!!请高人指点!!告诉要怎么下指令...
我试了好久了..快要疯掉了!!

Follow Ups:

- 自问自答 Joint 00:45:56 10/22/99 (0)