MustangPriMe
IS-IT--Management
I'm trying to parameterize a SQL command with SQL IN() as part of the WHERE clause:
Where strSelectedIds is a comma separated ID string e.g. "3,5,9" (number of Ids will vary)
It's picking up the @UserId parameter correctly, but not the @PermissionList parameter.
Can anyone see what I'm doing wrong? Is there a special requirement for using parameters in IN() clauses, as the parameter "value" is technically a string, and the IN() clause needs a list of integers?
Thanks in advance
Paul
Code:
Dim sqlCommD As New OleDbCommand("DELETE * FROM tblAdminUsersToPermissions WHERE (fldUserID=@UserId) AND (fldPermissionID NOT IN (@PermissionList));", sqlConn)
sqlCommD.Parameters.Add(New OleDbParameter("@UserId", intUserId))
sqlCommD.Parameters.Add(New OleDbParameter("@PermissionList", strSelectedIds))
sqlCommD.ExecuteNonQuery()
Where strSelectedIds is a comma separated ID string e.g. "3,5,9" (number of Ids will vary)
It's picking up the @UserId parameter correctly, but not the @PermissionList parameter.
Can anyone see what I'm doing wrong? Is there a special requirement for using parameters in IN() clauses, as the parameter "value" is technically a string, and the IN() clause needs a list of integers?
Thanks in advance
Paul