EJMessageSequence表中有一个字段SeqNo,其类型为bigint,它既不是主键,也不是自增长,现在c#中需要将此字段更改为我传入的一个值,
  
public bool UpdateEJSeqNumber(int num)
       {
            string sql = "update EJMessageSequence set SeqNo=@num";
            SqlParameter[] param = { new SqlParameter("@num",System.Data.DbType.Int64)};
            param[0].Value = num;            int i = DbHelperSQL.ExecuteSql(sql, param);
            if (i <= 0)
                return false;
            else
                return true;
        },DbHelperSQL的ExecuteSql()方法返回影响的记录数,请问为何i总是返回为0?

解决方案 »

  1.   

    参数类型用System.Data.SqlDbType.BigInt试试?
      

  2.   

    不可能是参数类型的问题,另外你的DbHelperSQL执行失败难道不会吧报错吗?最好有错误信息,否则就应该是执行成功,至于影响行数不代表是否执行成功。
      

  3.   

    你木有更新功。。所以返回0SqlParameter[] param = { new SqlParameter("@num",System.Data.DbType.Int64)};这句应该有问题。。换几个类型试试
    比如long/Int64/Int32等等。。
    下面有个链接,是有人整理的。。但我感觉不咋对,仅供参考
    http://weikaishio.blog.hexun.com/26164448_d.html
      

  4.   

    DbHelperSQL执行没有报错,可能是其他方法的问题吧,又或者是并发的问题
      

  5.   

     DbHelperSQL.ExecuteSql
    这个方法封装了什么,除非是封装ExecuteNonQuery,否则返回不了你执行SQL影响的行数