请各位大虾指点,本人新手半吊子···
我要在删除主表的信息时,附带删除其他次表的关联信息。
次表是用sort关联主表id的。
实例如下 myDl.Deleg_Delete += delegate(string id)
{
myDC.open();
myDC.sqlExecute("delete from aci_carrding_infor where sort =" + id);
myDC.close();
return "";
};我这样写,报错是“System.NullReferenceException: 未将对象引用设置到对象的实例。”
求各位大虾解困。
我要在删除主表的信息时,附带删除其他次表的关联信息。
次表是用sort关联主表id的。
实例如下 myDl.Deleg_Delete += delegate(string id)
{
myDC.open();
myDC.sqlExecute("delete from aci_carrding_infor where sort =" + id);
myDC.close();
return "";
};我这样写,报错是“System.NullReferenceException: 未将对象引用设置到对象的实例。”
求各位大虾解困。
这个错误是说引用传递有null值,你查找下哪个对象是null
这边只用到3个东西 "sort" "id" "table"("aci_carrding_infor")
不会有null的啊。
发现delegate(string id)里的id是空的。这怎么破。。-0-
这一个语句里"sort=" 后面的id并不是前面的string id。
怎么办