C#sql参数传递

         假设不需要动态传参数的时候,语句为: select * from stuDB where SID ='1409044101';

    进行如下步骤:

      1. select * from stuDB where SID = ' ';                   然后在' ' 中添加 " "

      2. select * from stuDb where SID = ' " " ';              然后在 " " 中添加 + + ,两个+号

      3. select * from stuDB where SID = ' "++ " ' ;          然后在 ++ 中添加 要动态传入的字符串

      4. select *from stuDB where SID = ' " +stuId+  " ';  然后把语句 复制到 String sql = " "; 中的引号中

猜你喜欢

转载自blog.csdn.net/xiehaiyang1234/article/details/80192708