DataGrid中按钮列的事件
private void borrow(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
DataRow dr=dataSet11.Tables["Document"].Rows.Find(e.Item.Cells[0].Text);
dr["borrow"]="1";
dr["borrower"]=Session["username"];
sqlDA1.Update(dataSet11,"Document");
DataGrid1.DataSource=dataSet11.Tables["Document"];
DataGrid1.DataBind();
}未将对象引用设置到对象的实例。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。
异常详细信息: System.NullReferenceException: 未将对象引用设置到对象的实例。
源错误:
行 235: dr["borrow"]="1";不明白是为什么?
private void borrow(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
DataRow dr=dataSet11.Tables["Document"].Rows.Find(e.Item.Cells[0].Text);
dr["borrow"]="1";
dr["borrower"]=Session["username"];
sqlDA1.Update(dataSet11,"Document");
DataGrid1.DataSource=dataSet11.Tables["Document"];
DataGrid1.DataBind();
}未将对象引用设置到对象的实例。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。
异常详细信息: System.NullReferenceException: 未将对象引用设置到对象的实例。
源错误:
行 235: dr["borrow"]="1";不明白是为什么?
-->
dr["Document"]
返回null值,没有符合的相关记录
不知道是哪出错,我觉得可能的地方都看了一遍。