How to use the Datagrid with multiple tables.

  • Thread starter Thread starter cr113
  • Start date Start date
C

cr113

Suppose you have the following 2 database tables:


Table1 - primary key = Field1
Field1 Field2
a 1
b 2
c 2


Table2 - primary key = Field2
Field2 Field3
1 Y
2 Z


I can display this in a datagrid:


Field1 Field2 Field3
a 1 Y
b 2 Z
c 2 Z


How do I update the underlying database tables? It's easy with one
table but I can't find any documentation on how to do it with multiple
tables.
 
Suppose you have the following 2 database tables:


Table1 - primary key = Field1
Field1 Field2
a 1
b 2
c 2


Table2 - primary key = Field2
Field2 Field3
1 Y
2 Z


I can display this in a datagrid:


Field1 Field2 Field3
a 1 Y
b 2 Z
c 2 Z


How do I update the underlying database tables? It's easy with one
table but I can't find any documentation on how to do it with multiple
tables.

Take a look at dataset merge. The two table must have the same primary key,
so you will have to use field 2 as the primary key. You can use the missing
schema action to add the field3 column.
 
Back
Top