-4
Dim id As Integer
Dim tempIdList As List(Of Integer)
If dr.Read() Then
Do
Dim loc As String
loc = dr("CurrentLocation").ToString()
id = dr("ID")
'tempIdList.Add(dr("ID"))
'tempIdList.Add(id)
If loc = comboFrom.Text Then
isContinue = True
End If
Loop While dr.Read
End If
我曾尝试那些注释掉的代码添加值。但我得到Object reference not set to an instance of an object
。
我试着添加一个断点,看起来这个列表没有得到一个值,只是Nothing
,而id
具有来自访问数据库的ID的值。列表不从数据库
出了什么问题?
可能重复(http://stackoverflow.com/questions/4660142/what-is -a-的NullReferenceException和知识-DO-I-FIX-IT) – sloth