Using dataadapter's update method u can do this.
make whatever changes you want to make and pass the updated datatable or
dataset to the update method of dataadapter. Inside update method mention
DataRowViewState enumeration for desired records
SqlConnection con = New SqlConnection ("connect string");
SqlDataAdapter da = new SqlDataAdapter();
da.SelectCommand = New SqlCommand("SqlQuery", con) ;
DataSet ds = new DataSet();
da.Fill(ds);
// Make changes In ds tables
// Use Command Builder to make appropriate commands
// Fire Delete first
da.Update(ds, DataRowViewState.Deleted);
// Fire Update
da.Update(ds, DataRowViewState.ModifiedCurrent);
// Fire Insert
da.Update(ds, DataRowViewState.Added);
try this
Satish Pahade
----- Original Message -----
From: "smita" <smita@j...>
To: "ASPX_Professional" <aspx_professional@p...>
Sent: Tuesday, March 11, 2003 7:18 PM
Subject: [aspx_professional] How to reflect the changes back to Database??
> hi all,
>
> i'm playing with database tables by getting their data in datatables
> i'm changing the datatables through my code and want the changes
> to get reflected to my original database tables.
>
> how do i achieve this?? is it possible??
> if not is there any other way to do this??
>
> thanx in advance
> waiting for reply...
>
> regards,
> smita
>
>
>