I am trying to write a database app with three tables. I have figured out how to connect to my database with oledbconnect. From there I am confused as to how to get a select command to work. I have found plenty of info on selecting data from one table using the SQL QUERY option. I do not want to select from one table. I want to select from two tables, for example:
select, tbl2.address
from table1 tbl1, table2 tbl2
where =

This should not be so difficult, but it is. I am not certain if I have to do something with the dataset, data-adapter or what. I would like someone out there to give me a step-by-step as to what I need to click-and-or-drag when setting up the connection, dataset, etc. Thanks ahead of time for the expertise!

in your dataadapter do

OleDBDataAdapter da = new OleDBDataAdapter("select, tbl2.address from table1 tbl1, table2 tbl2 where =", conn);

From there, you can do a datareader or fill a datatable. As long as the join columns are of the same type, you should have no issues.

I rarely use the wizrds to create the datasource and dataadapters so I can't really help you with a step by step, but if you look at you'll get the picture.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.