Total rows in DataSet
-
Hi, Could anybody tell me what I'm doing wrong with this:
Dim objDsExistingXRatesFile As DataSet objDsExistingXRatesFile = New DataSet("StoredRates") objDsExistingXRatesFile.ReadXml("xrates.xml") Dim MaxRows = objDsExistingXRatesFile.Tables("StoredRates").Rows.Count MsgBox(MaxRows.ToString)
Its giving me an error on the 'Dim MaxRows' line saying, "NullReferenceException was unhandled" - "Object reference not set to an instance of an object" - advising me that I need to use the New command. It isn't null, because I can put the data into a DataGridView to test it! -
Hi, Could anybody tell me what I'm doing wrong with this:
Dim objDsExistingXRatesFile As DataSet objDsExistingXRatesFile = New DataSet("StoredRates") objDsExistingXRatesFile.ReadXml("xrates.xml") Dim MaxRows = objDsExistingXRatesFile.Tables("StoredRates").Rows.Count MsgBox(MaxRows.ToString)
Its giving me an error on the 'Dim MaxRows' line saying, "NullReferenceException was unhandled" - "Object reference not set to an instance of an object" - advising me that I need to use the New command. It isn't null, because I can put the data into a DataGridView to test it! -
Hi, Could anybody tell me what I'm doing wrong with this:
Dim objDsExistingXRatesFile As DataSet objDsExistingXRatesFile = New DataSet("StoredRates") objDsExistingXRatesFile.ReadXml("xrates.xml") Dim MaxRows = objDsExistingXRatesFile.Tables("StoredRates").Rows.Count MsgBox(MaxRows.ToString)
Its giving me an error on the 'Dim MaxRows' line saying, "NullReferenceException was unhandled" - "Object reference not set to an instance of an object" - advising me that I need to use the New command. It isn't null, because I can put the data into a DataGridView to test it! -
Check that the table "StoredRates" actually exists in the objDsExistingXRatesFile dataset. It looks like the name of your dataset is "StoredRates", not the table. Not sure what the table name would be as that may depend on your XML.
Thanks for your replies. I did a message box for objDsExistingXRatesFile.Tables(0).TableName. I assumed I was assigning the table name when I did the line objDsExistingXRatesFile = New DataSet("StoredRates"). .... obviously not ;)