说我GridViewRow 里不能用带[]的索引!
 那要怎么做啊,怎么改啊! 哭!
     foreach (GridViewRow dr in GridView1.Rows)
         {
         chk  = (CheckBox)dr.FindControl("checkboxname");
             if (chk.Checked)
             {
               
                 int QTY = Convert.ToInt32(dr[4].ToString());
                 string PRD_NO = dr[2].ToString();
                 string PRD_NAME = dr[3].ToString();
                 string BO_NO = _BO_NO;
                 string insertSQL = "insert into OP_Prdt_Borrow(BO_NO,Prdt_NO) vaules('" + BO_NO + "','" + PRD_NO + "')";
                 link.ExcuteDataBase(insertSQL);             }

解决方案 »

  1.   

    System.Web.UI.WebControls.CheckBox chk;
                string _BO_NO = year + month + day + Number;
                foreach (GridViewRow dr in GridView1.Rows)
             {
             chk  = (CheckBox)dr.FindControl("checkboxname");
                 if (chk.Checked)
                 {
                   
                     int QTY = Convert.ToInt32(dr.Cells[4].ToString());
                     string PRD_NO = dr.Cells[2].ToString();
                     string PRD_NAME = dr.Cells[3].ToString();
                     string BO_NO = _BO_NO;
                     string insertSQL = "insert into OP_Prdt_Borrow(BO_NO,Prdt_NO) vaules('" + BO_NO + "','" + PRD_NO + "')";
                     link.ExcuteDataBase(insertSQL);             }
    在      if (chk.Checked) 这里过不去! 
    $exception {"未将对象引用设置到对象的实例。"} System.Exception {System.NullReferenceException}
    这要怎么处理啊!