|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Multiple Table DataSethas 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 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: Show quoteHide quote > 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 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 Show quoteHide quote "Izzy" <israel.rich***@gmail.com> schreef in bericht news:1156194406.568328.152040@i42g2000cwa.googlegroups.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 > Didn't know that, thanks Cor.
I have some code to change. Cor Ligthert [MVP] wrote: Show quoteHide quote > 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" <israel.rich***@gmail.com> schreef in bericht > news:1156194406.568328.152040@i42g2000cwa.googlegroups.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 > > 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 Show quoteHide quote "samoore33" <samoor***@gmail.com> schreef in bericht news:1156189758.079549.240870@m73g2000cwd.googlegroups.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 > 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: Show quoteHide quote > 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" <samoor***@gmail.com> schreef in bericht > news:1156189758.079549.240870@m73g2000cwd.googlegroups.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 > > Scott,
And you know now how to do it? Cor Show quoteHide quote "samoore33" <samoor***@gmail.com> schreef in bericht news:1156207566.964878.75640@m79g2000cwm.googlegroups.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" <samoor***@gmail.com> schreef in bericht >> news:1156189758.079549.240870@m73g2000cwd.googlegroups.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 >> > > 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: Show quoteHide quote > Scott, > > And you know now how to do it? > > Cor > > "samoore33" <samoor***@gmail.com> schreef in bericht > news:1156207566.964878.75640@m79g2000cwm.googlegroups.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" <samoor***@gmail.com> schreef in bericht > >> news:1156189758.079549.240870@m73g2000cwd.googlegroups.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 > >> > > >
Handling refreshes from browser
Re: SQL query to Excel file windowclosing not firing Change box color on checkbox control how to display a label only a while? How to check base class type of 'open' generic class? (inheritance check) Re: SQL query to Excel file Has Dataset Changed? Re: MS Access Reports and VB.NET Program Catch Application After Exit (WaitforExit) VB.Net |
|||||||||||||||||||||||