The reason for this is this line:
For Each myState In myDataSet.Tables
Even though your setting it to a specific table, this line sets it to
each table in the dataset starting with table(0).
When you say you want to list all the ITEMS do you mean data in the
columns or do you want to list the column names?
This is how you list the data in each column in a table.
Dim table As DataTable = dataset.tables("Whatever")
Dim row As DataRow
Dim b As Byte
For Each row In table.Rows
For b = 0 To table.Columns.Count - 1
TextBox1.Text = TextBox1.Text & row(b)
Next
Next
This is how you list each column name in the table.
Dim table As DataTable
Dim row As DataRow
Dim column As DataColumn
For Each row In table.Rows
For Each column In table.Columns
TextBox1.Text = TextBox1.Text & column.ColumnName
Next
Next
samoore33 wrote:
I want to list all of the items in a dataset in a textbox. The dataset
has multiple tables. When I try to use the code below, even though I
dim myState as the DataTable("state"). It still looks for othe rows in
the dataset.
Dim myState As DataTable = myDataSet.Tables("state")
Dim myTax As DataTable = myDataSet.Tables("Tax")
Dim row As DataRow
Dim column As DataColumn
For Each myState In myDataSet.Tables
For Each row In myState.Rows
For Each column In myState.Columns
txtList.Text += row("id").ToString()
Next
Next
Next
A friend sent me some code that parses the DataSet and shows me the
structure of it. The first table is called "state" and the third table
is called "Tax".
Any help would be appreciated.
Scott Moore