Home All Groups Group Topic Archive Search About

Please. join 2 tables and datagrid

Author
5 Jun 2006 3:44 AM
Jose
I have a datagrid with 3 columns. I have 2 tables. the question is. ¿How
obtain or show in my datagrid the column1 and column2 of my fields the my
table1 and de column3 a field of my table2?

Thanks a lot.

Author
5 Jun 2006 4:37 AM
Steven Nagy
Not quite sure I understand your english but if you are asking this:
"How do I show 2 columns from one table, and 1 column from another
table in one table in a datagrid?" then the answer is to
programatically create a 3rd table and add the contents of the other 2
tables as necessary. Then bind your datagrid to the 3rd new table.

But of course there are many issues to consider, such as how the data
is related between the 2 tables. Is it a 1-1 relationship? If not, then
I would question what you are trying to achieve.

Also, you can always JOIN the data before you select it from the
database, that way you will only get one table back that you can bind
directly to your datagrid.

SN


Jose wrote:
Show quoteHide quote
> I have a datagrid with 3 columns. I have 2 tables. the question is. ¿How
> obtain or show in my datagrid the column1 and column2 of my fields the my
> table1 and de column3 a field of my table2?
>
> Thanks a lot.
Author
5 Jun 2006 1:29 PM
Jose
Sorry for my bad english Steven. Do you have a example code?

Thanks a lot
"Steven Nagy" <learndot***@hotmail.com> escribió en el mensaje
news:1149482243.749837.17210@i40g2000cwc.googlegroups.com...
Not quite sure I understand your english but if you are asking this:
"How do I show 2 columns from one table, and 1 column from another
table in one table in a datagrid?" then the answer is to
programatically create a 3rd table and add the contents of the other 2
tables as necessary. Then bind your datagrid to the 3rd new table.

But of course there are many issues to consider, such as how the data
is related between the 2 tables. Is it a 1-1 relationship? If not, then
I would question what you are trying to achieve.

Also, you can always JOIN the data before you select it from the
database, that way you will only get one table back that you can bind
directly to your datagrid.

SN


Jose wrote:
Show quoteHide quote
> I have a datagrid with 3 columns. I have 2 tables. the question is. ¿How
> obtain or show in my datagrid the column1 and column2 of my fields the my
> table1 and de column3 a field of my table2?
>
> Thanks a lot.
Author
6 Jun 2006 6:25 AM
Steven Nagy
Example of which one? The SQL join?