Please. join 2 tables and datagrid

J

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.
 
S

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
 
J

Jose

Sorry for my bad english Steven. Do you have a example code?

Thanks a lot
"Steven Nagy" <[email protected]> escribió en el mensaje
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top