The DataAdapter usually only updates a single Table at a time.  If you
send a DataSet to the Update (as in dataAdapter.Update(dataSet)), it
will attempt to update a table called "Table".  Probably not what you
want.

Do update the database:

SqlDataAdapter Da1 ...
SqlDataAdapter Da2 ...

DataSet ds = new DataSet();

Da1.Fill(ds, "FirstTable");
Da2.Fill(ds, "SecondTable");

CommandBuilder bldr1 = new CommandBuilder(Da1);
CommandBuilder bldr2 = new CommandBuilder(Da2);

Da1.Update(ds, "FirstTable");
Da2.Update(ds, "SecondTable");


HTH

Thanks,

Shawn Wildermuth
[EMAIL PROTECTED]

> -----Original Message-----
> From: dotnet discussion [mailto:[EMAIL PROTECTED]]
> On Behalf Of franklin gray
> Sent: Monday, April 15, 2002 3:48 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [DOTNET] updating dataset and dataform
>
>
> I would update the dataset and then update the DB using the
> .update on the adapter passing it the dataset.  You may also
> want to look into .getchanges of the dataset.
>
> -----Original Message-----
> From: Bob Edwards [mailto:[EMAIL PROTECTED]]
> Sent: Monday, April 15, 2002 2:40 PM
> To: [EMAIL PROTECTED]
> Subject: [DOTNET] updating dataset and dataform
>
>
> I have a design in which I fill a dataset with two tables and
> I create a relation between them. The queries to fill the two
> tables use lookups into other tables (e.g., the main table
> holds an integer which is an id in a lookup table). I use
> that dataset to fill a datagrid in a form. Works great.
>
> When you click on a row in the grid, you see a detail page in
> a panel below the grid. You can edit the record in the panel
> and click SAVE. When you do, a new record is created in the
> secondary table.
>
> My question is this: I want save to update the database and I
> want the grid and the panel to be updated as well. Would you
>
> a) update the db and then recreate the dataset and refresh the grid or
> b) update the dataset and then use that to update the database
>
> Which is the preferred approach, and why?
>
> Thanks.
>
> Bob Edwards.
>
> You can read messages from the DOTNET archive, unsubscribe
> from DOTNET, or subscribe to other DevelopMentor lists at
> http://discuss.develop.com.
>
> You can read messages from the
> DOTNET archive, unsubscribe from DOTNET, or subscribe to
> other DevelopMentor lists at http://discuss.develop.com.
>

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to