对象引用未设置为对象的实例 [英] object refrence not set to an instance of an object

查看:97
本文介绍了对象引用未设置为对象的实例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

tblname = "store_child"
For tcnt = 1 To fg.Rows.Count - 1
  If Convert.ToString(fg.GetData(tcnt, "itmcode")) = "" Or Convert.ToString(fg.GetData(tcnt, "iname")) = "" Then
   Call txtclear()
   
   hcode = String.Empty
   
   Call maxno()
   Exit Sub
  End If
  
  ssql = "insert into store_child(vono,site,itmcode,iqty,irate,itotal,remark) values" & _
         "('" & Me.txt_grn.Text & "','" & loginsite & "'," & _
         "'" & CStr(Me.fg.GetData(tcnt, "itmcode")).ToString() & "','" & CStr(Me.fg.GetData(tcnt, "iqty")) & "'" & _
         ",'" & CStr(Me.fg.GetData(tcnt, "irate")) & "','" & CStr(Me.fg.GetData(tcnt, "itotal")) & "','" & CStr(Me.fg.GetData(tcnt, "remark")) & "')"
  
  fn.saveqry(ssql, tblname)
Next




我想从我的flexgrid将数据存储在oledb数据库中
在我的代码"fg"中是我的flexgrid的名称

但是我遇到了这个错误
"object refrence not set to an instance of an object"




i want to store data in oledb database from my flexgrid
in my code "fg" is the name of my flexgrid

but i m facing this error
"object refrence not set to an instance of an object"

推荐答案

这里有很多可能的来源,因此不可能很精确.
查看错误-它会告诉您哪一行有问题.发生异常时,请查看突出显示的行,然后将其分解为离散的块,或者手动检查每个元素以找出导致问题的原因.

最佳的揣测?您拼错了itmcode iqty irate 或...
There are so many possible sources here that it is not possible to be precise.
Look at the error - it will tell you which line has the problem. When the exception occurs, look at the line it highlights, and either break it into discrete chunks or manually examine each element to find out which is causing the problem.

Best guess? You have misspelled itmcode or iqty or irate or ...


这篇关于对象引用未设置为对象的实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆