BillLumbergh
Programmer
We've got a VB6 application that hits a MS SQL Server 2000 DB. We use command object to append query parameters. What I cannot figure out is how to use the command object paremeter append method when dealing with a SQL in() function. How do you use parameter.append when referring to a SQL in() value as follows:
strSQL = "select * from my_table where add_user_id = ? and type_id in (?)"
Set cnn = CreateObject("ADODB.Connection")
Set cmd = CreateObject("ADODB.Command")
Set objRS = CreateObject("ADODB.Recordset")
With cmd
.CommandText = strSQL
.CommandType = adCmdText
.Parameters.Append .CreateParameter("add_user_id", adVarChar, adParamInput, 30, "BillLumbergh")
.Parameters.Append .CreateParameter("type_id", adInteger, adParamInput, , "1,2,3")
Set objRS = .Execute
End With
Can it even be done, or do you have to break the "in()" out and say "=? or =? or =?"?
Thanks.
strSQL = "select * from my_table where add_user_id = ? and type_id in (?)"
Set cnn = CreateObject("ADODB.Connection")
Set cmd = CreateObject("ADODB.Command")
Set objRS = CreateObject("ADODB.Recordset")
With cmd
.CommandText = strSQL
.CommandType = adCmdText
.Parameters.Append .CreateParameter("add_user_id", adVarChar, adParamInput, 30, "BillLumbergh")
.Parameters.Append .CreateParameter("type_id", adInteger, adParamInput, , "1,2,3")
Set objRS = .Execute
End With
Can it even be done, or do you have to break the "in()" out and say "=? or =? or =?"?
Thanks.