SqlDataAdapter.UpdateCommand如下

"update Student set ID=@ID where ID=@ID"

这样写当修改id的时候会出现,错误:违反并发性。。

因为id改变了where 后面的id和前面的id是不一样的

解决方法:

"update Student set ID=@ID where ID=@ID2"

SqlParameter pID2 = new SqlParameter("@ID_OLD", SqlDbType.Int, 4, "ID");
pID2.SourceVersion = DataRowVersion.Original;

相关文章:

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