Display Joined Data in Datagrid after inserts?

  • Thread starter Thread starter James Goodman
  • Start date Start date
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?
 
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.
 
Back
Top