473,385 Members | 1,492 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Multiple Table DataSet

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

Aug 21 '06 #1
7 2079
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
Aug 21 '06 #2
Izzy,

You know that it is more expensive to take a byte as indexer.
The cheapest one one a 32bit system is the integer (int32).

(Your process to set it in the accumulator register takes more than that 3
bytes that you think to save).

Cor

"Izzy" <is************@gmail.comschreef in bericht
news:11**********************@i42g2000cwa.googlegr oups.com...
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

Aug 21 '06 #3
Scott,

Why not just use a datagrid

mydatagrid.datasource = myDataset

Otherwise you have to loop through this set which all contains collections
dataset (has a collection of datatables with the name tables)
datatables (has a collecion of datarows with the name rows
datarows (has a collection of items which are the default)

All the collections have a count, while they all can be indexed by an
integer.

I hope this helps,

Cor

"samoore33" <sa*******@gmail.comschreef in bericht
news:11**********************@m73g2000cwd.googlegr oups.com...
>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

Aug 21 '06 #4
Didn't know that, thanks Cor.

I have some code to change.
Cor Ligthert [MVP] wrote:
Izzy,

You know that it is more expensive to take a byte as indexer.
The cheapest one one a 32bit system is the integer (int32).

(Your process to set it in the accumulator register takes more than that 3
bytes that you think to save).

Cor

"Izzy" <is************@gmail.comschreef in bericht
news:11**********************@i42g2000cwa.googlegr oups.com...
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
Aug 21 '06 #5
Cor,

Believe me I would love to use a datagrid, I have a lot more experience
with datagrids. They want the information to populate a text box rather
then a datagrid.

Fun fun fun

Scott

Cor Ligthert [MVP] wrote:
Scott,

Why not just use a datagrid

mydatagrid.datasource = myDataset

Otherwise you have to loop through this set which all contains collections
dataset (has a collection of datatables with the name tables)
datatables (has a collecion of datarows with the name rows
datarows (has a collection of items which are the default)

All the collections have a count, while they all can be indexed by an
integer.

I hope this helps,

Cor

"samoore33" <sa*******@gmail.comschreef in bericht
news:11**********************@m73g2000cwd.googlegr oups.com...
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
Aug 22 '06 #6
Scott,

And you know now how to do it?

Cor

"samoore33" <sa*******@gmail.comschreef in bericht
news:11*********************@m79g2000cwm.googlegro ups.com...
Cor,

Believe me I would love to use a datagrid, I have a lot more experience
with datagrids. They want the information to populate a text box rather
then a datagrid.

Fun fun fun

Scott

Cor Ligthert [MVP] wrote:
>Scott,

Why not just use a datagrid

mydatagrid.datasource = myDataset

Otherwise you have to loop through this set which all contains
collections
dataset (has a collection of datatables with the name tables)
datatables (has a collecion of datarows with the name rows
datarows (has a collection of items which are the default)

All the collections have a count, while they all can be indexed by an
integer.

I hope this helps,

Cor

"samoore33" <sa*******@gmail.comschreef in bericht
news:11**********************@m73g2000cwd.googleg roups.com...
>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

Aug 22 '06 #7
Cor,

Yes. I used what Izzy gave me to figure it out. I really do appreciate
the help from both Izzy and you.

Thanks a lot!

Scott

Cor Ligthert [MVP] wrote:
Scott,

And you know now how to do it?

Cor

"samoore33" <sa*******@gmail.comschreef in bericht
news:11*********************@m79g2000cwm.googlegro ups.com...
Cor,

Believe me I would love to use a datagrid, I have a lot more experience
with datagrids. They want the information to populate a text box rather
then a datagrid.

Fun fun fun

Scott

Cor Ligthert [MVP] wrote:
Scott,

Why not just use a datagrid

mydatagrid.datasource = myDataset

Otherwise you have to loop through this set which all contains
collections
dataset (has a collection of datatables with the name tables)
datatables (has a collecion of datarows with the name rows
datarows (has a collection of items which are the default)

All the collections have a count, while they all can be indexed by an
integer.

I hope this helps,

Cor

"samoore33" <sa*******@gmail.comschreef in bericht
news:11**********************@m73g2000cwd.googlegr oups.com...
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
Aug 22 '06 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: | last post by:
Hi, I have an app that uses a typed dataset to persist user data. The dataset has a multiple tables with multiple table relations. The problem I am running into is that the user data is...
3
by: lee_mcknight | last post by:
I am using Crystal Enterprise V9. I have a report that needs to have multiple datasets as the datasource(s) on a single subreport (some common lookup data I need to join to is stored in a seperate...
0
by: John Bailey | last post by:
I have a dataset with multiple data tables. I need to bind this to a wizard interface, where each portion of the wizard udates the information in one of the datatables. I am using formviews in...
9
by: Graham | last post by:
I have been having some fun learning and using the new Controls and methods in .Net 2.0 which will make my life in the future easier and faster. Specifically the new databinding practises and...
9
by: jaYPee | last post by:
I have search a lot of thread in google newsgroup and read a lot of articles but still i don't know how to update the dataset that has 3 tables. my 3 tables looks like the 3 tables from...
4
by: Dave Edwards | last post by:
I understand that I can fill a datagrid with multiple queries, but I cannot figure out how to fill a dataset with the same query but run against multiple SQL servers, the query , table structure...
12
by: Peter Proost | last post by:
Hi group, has anyone got any suggestions fot the best way to handle this problem, I've got 3 tables for example table A, B, and C table A looks like name, value table B looks like name, value...
3
by: TomH | last post by:
I am using VB within VS 2005. How can I have multiple datagridviews on the same form pulling from the same table? e.g. I want to see all clients from New York in one view and all clients from LA in...
7
by: =?Utf-8?B?TG9zdEluTUQ=?= | last post by:
Hi All :) I'm converting VB6 using True DBGrid Pro 8.0 to VB2005 using DataGridView. True DBGrid has a MultipleLines property that controls whether individual records span multiple lines. Is...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.