以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  未将对象引用设置到对象的实例  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=56167)

--  作者:jiangxun
--  发布时间:2014/8/30 21:56:00
--  未将对象引用设置到对象的实例

Dim dt As DataTable
Dim dr As DataRow
dr("档号") = e.Form.Controls("TextBox_档案号").value
datatables("档案管理").save()

 

上述代码是“修改”按钮的click事件,其中textbox_档案号,文本框的值是空值

 

上述代码执行后系统提示“未将对象引用设置到对象的实例”,这个错误应该怎么改


--  作者:程兴刚
--  发布时间:2014/8/31 0:58:00
--  

Dim tb As Table = tables("档案管理")

if tb.Current isnot nothing
    Dim dr As DataRow = tb.Current.datarow
    dr("档号") = e.Form.Controls("TextBox_档案号").value
    tb.datatable.save()

end if