C# Parameterized Query MySQL with `in` clause

前端 未结 7 1783
感情败类
感情败类 2020-12-03 15:36

I am in the process of converting several queries which were hard-coded into the application and built on the fly to parameterized queries. I\'m having trouble with one part

相关标签:
7条回答
  • 2020-12-03 16:34

    This is not possible in MySQL. You can create a required number of parameters and do UPDATE ... IN (?,?,?,?). This prevents injection attacks (but still requires you to rebuild the query for each parameter count).

    Other way is to pass a comma-separated string and parse it.

    0 讨论(0)
提交回复
热议问题