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

后端 未结 8 736
梦如初夏
梦如初夏 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:21

    It's impossible to detect SQL injection after the fact (in other words, once you've constructed a dynamic query string, it's impossible to differentiate what the "real" SQL is versus any injected SQL).

    If your intent is to allow users to execute arbitrary SQL, then it would seem like you wouldn't be too worried about SQL injection (since that is the aim of SQL injection).

提交回复
热议问题