Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem updating Inserted row in my DataSet
Message
From
23/10/2007 16:56:38
Mike Cole
Yellow Lab Technologies
Stanley, Iowa, United States
 
 
To
23/10/2007 16:54:15
General information
Forum:
ASP.NET
Category:
ADO.NET
Miscellaneous
Thread ID:
01262924
Message ID:
01262925
Views:
14
Don't you want to perform an update on dirtyDS instead of ds?

>I having problem saving the data to SQL Server.
>
>Here is the code on my form :
>
>private void btnSave_Click(object sender, EventArgs e)
>        {
>           DataRow row =  this.dsPolicyNotes.Tables[0].NewRow();
>           row["PolID"] = this.PolID;
>           row["Note"] = this.rtbNotes.Text;
>           row["edate"] = DateTime.Now;
>           this.dsPolicyNotes.Tables[0].Rows.Add(row);
>
>                // Now proceed to call the update method in the biz object
>           this.oPolicyNotesBiz.UpdateDataSet(dsPolicyNotes);
>
>         }
>
>
>
>Here is the code in my Business layer :
>
> public void UpdateDataSet(DataSet ds)
>      {
>        // Here maybe I can put someloig
>        this.oDA.UpdateDataSet(ds);
>
>      }
>
>
>
>And here is my code in my DataAccess layer that is not updating in
>Sql Server
>
>
>public void UpdateDataSet(DataSet ds)
>        {
>            DataSet dirtyDS = ds.GetChanges();
>            //Take action.
>            ds.AcceptChanges();
>
>            SqlConnection con1  = new SqlConnection(this.connectionstring);
>            con1.Open();
>            SqlDataAdapter sqlAdapter1 = new SqlDataAdapter();
>            sqlAdapter1.Update(ds,"PolicyNotes");
>            con1.Close();
>
>        }
>
>
>
>The Update is not working an nothing is inserted in Sql server.
>
>Any help is appreciated.
>
>Thanks,
>Sergio
Very fitting: http://xkcd.com/386/
Previous
Reply
Map
View

Click here to load this message in the networking platform