A Repasky

A Repasky

  • NA
  • 231
  • 183.7k

How do you use a parameter in a SQL IN statement?

Jun 29 2011 4:53 PM
I have the following in a large SQL command in cmd.CommandText.

 WHERE Claims.GroupNbr IN('@grpno1','@grpno2') 

After the cmd.CommandText I have:

         cmd.Parameters.AddWithValue("@grpno1", groupno1); 
         cmd.Parameters.AddWithValue("@grpno2", groupno2);






I try to print the cmd.CommandText after this but it does not show the substitution.
How can I see the substitution?







But the main question is can I do this or how can I do this another way?

I know the command works if it is:







 WHERE Claims.GroupNbr = @grpno1


Thanks for any help,
arep
 



Answers (1)