更新访问数据库时未将datagridview实例设置为对象的实例 [英] datagridview instance not set to an instance of an object while updating the acess database
本文介绍了更新访问数据库时未将datagridview实例设置为对象的实例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
if (grdAddress.CurrentRow.Index <= -1)
{
return;
}
int Id = int.Parse(grdAddress.CurrentRow.Index.ToString());
在此代码中进行编辑时,删除时会出现错误,指出以下错误消息:
对象引用未设置为对象的实例.
非常感谢您的帮助.
in this code while edit, delete there is an error stating the following error message:
Object reference not set to an instance of an object.
Help will be highly appreciated.
推荐答案
检查您的grdAddress.CurrentRow是否不为空
check that your grdAddress.CurrentRow not null
使用数据键值更新它(如果您有)设置任何
update it using datakey values if u have set any
这篇关于更新访问数据库时未将datagridview实例设置为对象的实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文