Does using parameterized SqlCommand make my program immune to SQL injection?

后端 未结 5 1736
故里飘歌
故里飘歌 2020-11-27 19:12

I\'m aware that SQL injection is rather dangerous. Now in my C# code I compose parameterized queries with SqlCommand class:

SqlCommand command = ...;
command         


        
5条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-11-27 19:20

    Using SqlCommand a very good practice and as long as you don't concatenate SQL strings anywhere (including inside any stored procedures you call -- i.e. avoid dynamic SQL), you will be immune from SQL injection attacks.

提交回复
热议问题