Display Joined Data in Datagrid after inserts?

J

James Goodman

Take the following situation:

tblPerson
PersonID
PersonName

tblNumbers
NumberID
PersonID
Number


I would like to display the PersonName and their associated numbers in a
datagrid. I can do this by creating a query which uses an INNER JOIN. I then
use a data-adapter to fill the dataset table.

This works as expected (the grid shows the name and number), until I attempt
to insert a new record. When I insert a new record, because it is
uncomitted, the dataset table cannot display the results of the join, so the
PersonName value gets shown as null.

Alternatively, I can use a data-adapter and load each table into the dataset
individually. The grid can then be bound to tblNumbers and it works as
expected. However, I would like the grid to show the PersonName.

Any ideas on how I can get round this without comitting the data everytime?
 
W

W.G. Ryan eMVP

If I understand the problem correctly, you can use the separate tables (if
you use a join in SQL, then all bets are off using an adapter to do an
update), a datarelation and then use an Expression Column (create a new data
column and set the Expression property to the concatanated values you want)
If I understood the problem correctly, this should work for you.
 

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

Top