I’m working on some SQL code.
I’m familiar with the syntax
SELECT * FROM myTable WHERE myColumn in ('1','2','3');
Suppose I’m writing some C# code where I want to use a C# array where I used ('1','2','3'). How do I do that?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can build your SQL string dynamically.
If you know that the data in the array is good (not supplied by the user), you can just do a string.Join.
If you don’t know that it is sanitized data, then you should use a Command with parameters.