未将对象引用设置到对象的实例。
For Each dr As DataGridViewRow In Me.DataGridView1.Rows
Dim cbx As DataGridViewCheckBoxCell = DirectCast(dr.Cells(0), DataGridViewCheckBoxCell)
If CBool(cbx.FormattedValue) Then
'MessageBox.Show(dr.Cells(1).Value.ToString())
Dim sGUID2 As String = System.Guid.NewGuid.ToString()
Dim insert_DataGridView1 As String
insert_DataGridView1 = "insert into PUB.UD33(Key1,Number01,Character01,Character02,Character03,Character04,Character05,Character06," + _
"Character07,Character08,Date01,Character09,Character10,Character11,Character12,Character13,Character14,Character15" + _
") values('" + sGUID2.ToString() + "','" + int_Number01.ToString() + "','" + dr.Cells(1).Value.ToString() + "'," + _
"'" + dr.Cells(2).Value.ToString() + "','" + dr.Cells(3).Value.ToString() + "','" + dr.Cells(4).Value.ToString() + "'," + _
"'" + dr.Cells(5).Value.ToString() + "','" + dr.Cells(6).Value.ToString() + "','" + dr.Cells(7).Value.ToString() + "'," + _
"'" + dr.Cells(8).Value.ToString() + "','" + NowTime + "','" + dr.Cells(9).Value.ToString() + "','" + dr.Cells(10).Value.ToString() + "',"
+ _
"'" + dr.Cells(11).Value.ToString() + "','" + dr.Cells(12).Value.ToString() + "','" + dr.Cells(13).Value.ToString() + "'," + _
"'" + dr.Cells(14).Value.ToString() + "','" + dr.Cells(15).Value.ToString() + "')"
'MessageBox.Show(NowTime)
Me.TextBox1.Text = insert_DataGridView1
'lyh_odbc1.Get_DataTable(insert_DataGridView1)
End If
运行时报错,指向insert_DataGridView1 =...........这一句,
提示“未将对象引用设置到对象的实例。”
我发现这条sql语句没错呀,哪位帮帮忙
相关推荐
未将对象引用设置到对象的实例(C#出現的錯誤)
"未将对象引用设置到对象的实例"錯誤個人總結
未将对象引用设置到对象的实例问题原因
“System.NullReferenceException: 未将对象引用设置到对象的实例”问题可能原因如下: 1、ViewState 对象为Null。 2、DateSet 空。 3、sql语句或Datebase的原因导致DataReader空。 4、声明字符串变量时未赋空值就应用变量。 5、未用new初始化对象。 6、Session对象为空。 7、对控件赋文本值时,值不存在。 8、使用Request.QueryString()时,所获取的对象不存在,或在值为空时未赋初始值。 9、使用FindControl时,控件不存在却没有做预处理。 10、重复定义造成未将对象引用设置到对象的实例错误. 偶在ASP.Net中遇到的情况如下: 未将对象引用设置到对象的实例。 说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.NullReferenceException: 未将对象引用设置到对象的实例。
未将对象引用设置到对象的实例--可能出现的问题总结
1、ViewState 对象为Null。 2、DateSet 空。 3、sql语句或Datebase的原因导致DataReader空。 4、声明字符串变量时未赋空值就应用变量。 5、未用new初始化对象。 6、Session对象为空。 7、对控件赋文本值时,值不存在。 8、使用Request.QueryString()时,所获取的对象不存在,或在值为空时未赋初始值。 9、使用FindControl时,控件不存在却没有做预处理。 10、重复定义造成未将对象引用设置到对象的实例错误.
asp.net运行提示未将对象引用设置到对象的实例错误解决方法
未将对象引用设置到对象的实例 一、网络上的一般说法 1、ViewState对象为Null。 2、DateSet空。 3、sql语句或Datebase的原因导致DataReader空。 4、声明字符串变量时未赋空值就应用变量。 5、未用new初始化对象。 6、Session对象为空。 7、对控件赋文本值时,值不存在。 8、使用Request.QueryString()时,所获取的对象不存在,或在值为空时未赋初始值。 9、使用FindControl时,控件不存在却没有做预处理。 10、重复定义造成未将对象引用设置到对象的实例错误. 二、 (1)所设置的变量为空值或没有取到值,一般出现在传递参数的时
未将对象引用设置到对象的实例 (System.NullReferenceException)
System.NullReferenceException:未将对象引用设置到对象的实例,这是一个新鸟,中鸟,老鸟都避不开的错误


