Beginning the march

  • Thread starter Thread starter BobAchgill
  • Start date Start date
B

BobAchgill

Why do I get this syntax error for the code below:

SYNTAX ERROR MESSAGE:

'myTableinDS' is not a member of 'System.Data.Dataset'

I know the data set is good because when it is read in it
shows up in my datagrid. Now I just want to march
through the table row by row column by column
programmatically doing things with the table data.

But I don't seem to be able to create the variable
MyTableRows() As DataRow to get this process started.

Many thanks!

Bob

+++++++++++++++++++++++++++

CODE:
Dim myDS As DataSet = New DataSet

myDS.ReadXml("MyData_data.xml")

Dim MyTableRows() As DataRow = myDS.myTableinDS()


Dim myCol As DataColumn
Dim myRow As DataRow


If (MyTableRows.Length < 1) Then
'Console.WriteLine("No Rows Found")
Else
For Each myRow In MyTableRows
For Each myCol In myDS.myTableinDS.Columns
'Console.Write(vbTab & myRow
(myCol).ToString())
Next
Next
End If
 
Hi,

what's myTableinDS? Is it a string containing the tablename?

Try this (out of my head so watch typeO's):
Dim myDS As New DataSet
Dim MyTableRows As DataRow
Dim row, col as Integer
myDS.ReadXml("MyData_data.xml")


If (myDS .Tables(myTableinDS).Rows.count =0) Then
'Console.WriteLine("No Rows Found")
Else
For row = 0 to myDS .Tables(myTableinDS).Rows.count -1
For col = 0 to myDS .Tables(myTableinDS).Columns.count -1

'Console.Write(myDS.Tables(myTableinDS).Rows(row).Item(col))
Next
Next
End If


Hth Peter
 
Bob,

That it is showed in the datagrid, does not say that it is a dataset, it can
be every IList implementing array or collection however because of the name
probably a DataTable.

I hope this helps

Cor
 
Ok.

I plugged in the actual table name that is in my XML
schema into the code you gave me. But now I get the
ERROR:
Name 'IP_addresses' is not declared.

I wonder if this has anything to do with my XML file that
I read in??

We are reading in the the data XML file. Maybe we should
be reading in the associated Schema XML file???
Otherwise how will the IDE know what the table name is?

CODE:

Dim myDS As New DataSet
Dim MyTableRows As DataRow
Dim row, col As Integer
myDS.ReadXml("IP_addresses_data.xml")


If (myDS.Tables(IP_addresses).Rows.count = 0) Then
'Console.WriteLine("No Rows Found")
Else
For row = 0 To myDS.Tables
(IP_addresses).Rows.count - 1
For col = 0 To myDS.Tables
(IP_addresses).Columns.count - 1

'TextBox1.Text = myDS.Tables
(IP_addresses).Rows(row).Item(col)
'Console.Write(myDS.Tables
(myTableinDS).Rows(row).Item(col))
Next
Next
End If
 
The compiler sees IP_addresses as a *variable name* which is not
defined. If that is the table name, then, perhaps, it should be in
quotation marks?

If (myDS.Tables("IP_addresses").Rows.count = 0 Then
.....

Chris
 
Back
Top