Updating joined tables

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,
 
M

Miha Markic [MVP C#]

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.
 
R

Ramsey Schaffnit

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,
 
M

MS

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.
 

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