Updating joined tables

  • Thread starter Thread starter 11Oppidan
  • Start date Start date
1

11Oppidan

Hi,
I am trying to display data from two sqls tables in a datagrid, and then
alow the user to make changes that update one of the tables. Currently I am
bringing in two tables into a dataset, merging them and binding them to a
datagrid.

I then use a comand builder on one of the original sql tables in order to
update it.

It sort of works - I cant get tables to merge that have different numbers of
records.

Is there a better way to do this?

Thanks,
 
I would break (manually) dataset into two (or more) tables before doing
updates to database.
Or, you might consider using a stored procedure(s) for such an update.
AFAIK there is no simple solution.
 
Would it be good (i.e. 'useful'), bad, or indifferent to use different data
adapters for each table?

Miha Markic said:
I would break (manually) dataset into two (or more) tables before doing
updates to database.
Or, you might consider using a stored procedure(s) for such an update.
AFAIK there is no simple solution.

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/
SLODUG - Slovene Developer Users Group www.codezone-si.info

11Oppidan said:
Hi,
I am trying to display data from two sqls tables in a datagrid, and then
alow the user to make changes that update one of the tables. Currently I
am bringing in two tables into a dataset, merging them and binding them to
a datagrid.

I then use a comand builder on one of the original sql tables in order to
update it.

It sort of works - I cant get tables to merge that have different numbers
of records.

Is there a better way to do this?

Thanks,
 
Hi,

I would create a View with primary and foreign keys on the server.

Then create a dataset on that view and link the datagrid on it. With a
dataAdapter you should be able to update the View.
 
Back
Top