C# and MySQL .NET Connector - Any way of preventing SQL Injection attacks in a generic class?

后端 未结 8 727
梦如初夏
梦如初夏 2020-12-14 23:31

My idea is to create some generic classes for Insert/Update/Select via a C# (3.5) Winforms app talking with a MySQL database via MySQL .NET Connector 6.2.2.

For exam

8条回答
  •  遥遥无期
    2020-12-15 00:29

    You can't really do this - you'd need to write a SQL parser which to say the least is non-trivial and error prone.

    Bite the bullet and parametrize your queries.

提交回复
热议问题