给命令添加参数呀。如果你没参数,当然可以不用了
就是说,你SQL就如 “update table set a =1 "
还不是 "update table set a=@a"这样的,就不用用


cmd.CommandText = “select * from table where id=@ID";
cmd.parameters.add(new sqlParameters("ID", "11"));

这样就等于:
cmd.CommandText = “select * from table where id=11";



它是用来添加参数用的,就是你的查询语句中有 @p1,@p2,有几个,下面就要跟上几个,而且最好要把名字对应上,名字就是 @p1 这样的

相关文章:

  • 2022-12-23
  • 2021-07-03
  • 2022-12-23
  • 2022-12-23
  • 2021-07-25
  • 2022-12-23
  • 2022-01-25
  • 2022-12-23
猜你喜欢
  • 2021-07-07
  • 2022-12-23
  • 2021-05-19
  • 2021-09-21
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案