开发者

Object Reference Error filling a datarow

This is the code:

Dim dr() As DataRow = DataSet.Tables("TableName").Select("EVENTNAME = '" & name & "'")

I get an "Object reference not set to an instance of an object." Error when this line is executed. It is looping through a list of selected it开发者_运维知识库ems in a listbox. I think it has to do with how I have the datarow declared because I can look at the name and I see it ok and I also do a null check on the name before I use it.

Visual Studio 2008, VB.NET. Any ideas?


Yep it was a wrong table name. I guess after looking at the code for 8 hours that minor detail I just wasn't thinking to check. Thanks!


You probably have the wrong "TableName".


For me it looks like it is the select statement:

vm_DataTable_SELECT_string = "[MyField] = '" + vm_TEXT_string + "'"; DataRow[] o_DataRow_ARRAY_Found = vco_DataTable.Select (vm_DataTable_SELECT_string);

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜