关于SQL语句,请帮忙!谢谢!
Dim CMD As New ADODB.Command
Dim conn As String
Dim rs As ADODB.Recordset
conn = "Provider=SQLOLEDB.1;Password=ehero;Persist Security Info=True;User ID=sa;Initial Catalog=land;Data Source=ehero\ehero"
CMD.CommandText = "select @b=cantonshen from shen where cantonshi=@c"
CMD.Parameters.Append CMD.CreateParameter("@return_value", adInteger, adParamReturnValue)
CMD.Parameters.Append CMD.CreateParameter("@b", adVarChar, adParamInputOutput, 12)
CMD.Parameters.Append CMD.CreateParameter("@c", adVarChar, adParamInput, 12)
CMD("@c") = "太原市"
CMD.ActiveConnection = conn
CMD.Execute
b = CMD("@b")
MsgBox b
执行时出现错误:必须声明变量b,可我已经声明了呀,为什么呢,该怎么改正呢?十分苦恼