0

how to make parameterized query in vb .net using in operator in where clause?

"SELECT * FROM " & strTableName & " WHERE lower(EmailAddress) IN ( @MultipleEmailId )"

  • I don't close as duplicate because the answers there are mainly in C# but you can find your answer here: https://stackoverflow.com/questions/337704/parameterize-an-sql-in-clause – Steve Aug 13 '20 at 08:37
  • And remember that table names cannot be parameterized – Steve Aug 13 '20 at 08:37
  • 1
    [Here](https://www.vbforums.com/showthread.php?503298) is an example that I wrote some time ago. – jmcilhinney Aug 13 '20 at 08:43
  • Note that most database text searches will be case-insensitive, so there's generally no point to fixing the case of your values. – jmcilhinney Aug 13 '20 at 08:44
  • Use a table valued type in sql with EMailAdress as column. Create a DataTable with that column in your code and fill it. Use it as a dynamic parameter to call the Sql. Change the IN statement to a JOIN to your table parameter. – Alex B. Aug 13 '20 at 09:43

0 Answers0