Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试从查询结果的第一行获取数据。
这是我当前的代码(用户名 = 列名):
userName.InnerHtml = DBresult.DataSet.Tables(0).Rows(0)("USERNAME").ToString()
这是我得到的错误:
System.NullReferenceException: Object reference not set to an instance of an object.
像这样的东西应该工作。即使 Cstr 是旧方法。
Dim i as Integer For i = 0 To DBresult.DataSet.Tables(0).Rows.Count - 1 If IsDBNull(DBresult.DataSet.Tables(0).Rows(i)("USERNAME")) = True Then 'Do something Else userName.InnerHtml = Cstr(DBresult.DataSet.Tables(0).Rows(i)("USERNAME"))