问题描述
- 未将对象引用设置到对象的实例 vb。net
-
Public Sub depart_spc(ByRef rs As Data.DataTable, ByVal a As String) Dim j As Integer Dim n As Integer Dim i As Integer ' n = 500 Dim dt As DataTable = rs Dim dr As DataRow = dt.NewRow() ‘ 出现未将对象引用设置到对象的实例 怎么解决啊 Do a = Trim(a) j = InStr(1, a, " ") ' For i = 0 To 500 If j <> 0 Then dr(0) = a.Substring(0, j - 1) a = Mid(a, j + 1) ElseIf Len(a) <> 0 Then dr(0) = a a = "" End If ' Next Loop Until Len(a) = 0 dt.Rows.Add(dr) End Sub
解决方案
rs是不是不是DataTable对象转类型失败或者本身为NULL
解决方案二:
你上层调用送进来的 rs 本身就是 Nothing。
时间: 2024-11-10 20:08:00