Is there any way, using the command object with parameters, to pass in a comma-delimited list of numbers (a string) into an "IN" clause? Such as below:
dim tempcmd 'as ado command
dim parm1 'as command parameter
dim parm2 'as command parameter
Set tempcmd = CreateObject("ADODB.Command")
tempcmd.ActiveConnection = db
tempcmd.CommandText = "Delete from MyTable where " & _
"MyID in (?) and userID=?"
tempcmd.CommandType = adCmdText
Set parm1 = tempcmd.CreateParameter("myIDList",adVarChar,1)
Set parm2 = tempcmd.CreateParameter("userID",adInteger,1)
parm1.Value = MyUserID
parm2.Value = MyCommaDelimitedList
tempcmd.Parameters.Append parm1
tempcmd.Parameters.Append parm2
tempcmd.Execute
Let's say
MyCommaDelimitedList = "1,2,3,4,5"
dim tempcmd 'as ado command
dim parm1 'as command parameter
dim parm2 'as command parameter
Set tempcmd = CreateObject("ADODB.Command")
tempcmd.ActiveConnection = db
tempcmd.CommandText = "Delete from MyTable where " & _
"MyID in (?) and userID=?"
tempcmd.CommandType = adCmdText
Set parm1 = tempcmd.CreateParameter("myIDList",adVarChar,1)
Set parm2 = tempcmd.CreateParameter("userID",adInteger,1)
parm1.Value = MyUserID
parm2.Value = MyCommaDelimitedList
tempcmd.Parameters.Append parm1
tempcmd.Parameters.Append parm2
tempcmd.Execute
Let's say
MyCommaDelimitedList = "1,2,3,4,5"