• ArrayList add方法(转)


    由于 BrowerList 输出结果都是最后一条记录,后来网上查到了

                        if (dRead.HasRows)
                        {
                  List<Class_RejectQuery> BrowerList = new List<Class_RejectQuery>(); Class_RejectQuery listRow
    = new Class_RejectQuery(); while (dRead.Read()) { listRow.id=dRead.GetString(0); listRow.sn = dRead.GetInt32(1); listRow.times = dRead.GetInt32(2); listRow.cause = dRead.GetString(3); listRow.auditor = dRead.GetString(4); listRow.customer = dRead.GetString(5); listRow.department = Convert.IsDBNull (dRead [6])?"": dRead.GetString(6); listRow.targetPerson = dRead.GetString(7); listRow.recordName= Convert.IsDBNull (dRead[8] ) ? "" : dRead.GetString(8); listRow.auditDate = dRead.GetString(9); BrowerList.Add(listRow); } }

     仅仅是位置不同而已,结果却相大不相同

     1                     if (dRead.HasRows)
     2                     {
     3               List<Class_RejectQuery> BrowerList = new List<Class_RejectQuery>();
     4                          5                         while (dRead.Read())
     6                         {
                      Class_RejectQuery listRow = new Class_RejectQuery();
    7 listRow.id=dRead.GetString(0); 8 listRow.sn = dRead.GetInt32(1); 9 listRow.times = dRead.GetInt32(2); 10 listRow.cause = dRead.GetString(3); 11 listRow.auditor = dRead.GetString(4); 12 listRow.customer = dRead.GetString(5); 13 listRow.department = Convert.IsDBNull (dRead [6])?"": dRead.GetString(6); 14 listRow.targetPerson = dRead.GetString(7); 15 listRow.recordName= Convert.IsDBNull (dRead[8] ) ? "" : dRead.GetString(8); 16 listRow.auditDate = dRead.GetString(9); 17 BrowerList.Add(listRow); 18 } 19 }

    转自   https://blog.csdn.net/caluu/article/details/73321107

  • 相关阅读:
    数据库基础
    (转)数据流图
    (转)SQL执行顺序
    (转)数据库隔离级别及实现原理
    (转)求单链表是否有环,环入口和环长
    (转)最长公共子序列
    (转)Java锁、自旋锁、CAS机制
    Java线程状态转换
    OpenSUSE 13.2安装Texlive2014+Texmaker+Lyx
    GIMP也疯狂之动态图的制作(四)
  • 原文地址:https://www.cnblogs.com/bamboo-140/p/9485325.html
Copyright © 2020-2023  润新知