小弟设定一个gridview的autogeneratedeletebutton为true在gridview的row_deleting中添加如下代码
string mStr;
GridViewRow GRow = ListDetail.SelectedRow;
mStr = "delete from EL_AgentOrderPacking where id= " + GRow.Cells[1].Text ; //出错时光标停留在这句上,似乎是没有初始化对象
myConn.DBDelete(mStr); //删除记录
但是总是报“未将对象引用设置到对象的实例”但是把以上代码移到SelectedIndexChanged事件就通过,求各位帮忙啊,功能其实就是想用户单击删除连接就删除这条记录
------解决方案--------------------------------------------------------
string mStr = "delete from EL_AgentOrderPacking where id= " + this.GridView1.Rows[e.RowIndex].Cells[1].Text;