select对ExecuteNonQuery受影响行数返回无效
ExecuteNonQuery 只在insert,update,delete时才返回受影响行数 在select时总是返回-1
把代码写成:
.net中如何使用Select数据表的行数string strSql = "Select count(*) from ClsInfo where ClsName='"+ClsName+''";
.net中如何使用Select数据表的行数
int num=Convert.ToInt32(cmd.ExecuteScalar(strSql));

就可以用num接受受影响行数

相关文章:

  • 2022-02-02
  • 2022-12-23
  • 2021-08-19
  • 2021-12-25
  • 2022-12-23
  • 2022-02-18
  • 2021-08-09
  • 2021-09-28
猜你喜欢
  • 2021-09-19
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-30
相关资源
相似解决方案