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

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

    I would expect that it would be pretty hard to scrub raw text that will be used for SQL. If at all possible I would try to use parameterized operations.

    One exception would be if you didn't expose the function publicly, and you never passed in a string that was constructed from raw user input.

提交回复
热议问题