Creating safe SQL statements as strings

后端 未结 5 1978
终归单人心
终归单人心 2020-12-03 17:51

I\'m using C# and .NET 3.5. I need to generate and store some T-SQL insert statements which will be executed later on a remote server.

For example, I have an array o

5条回答
  •  -上瘾入骨i
    2020-12-03 18:20

    Use parameterised commands. Pass the parameters along to your remote server as well, and get that to call into SQL Server, still maintaining the distinction between the SQL itself and the parameter values.

    As long as you never mix treat data as code, you should be okay.

提交回复
热议问题