Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Problem updating Inserted row in my DataSet
Message
De
23/10/2007 16:56:38
Mike Cole
Yellow Lab Technologies
Stanley, Iowa, États-Unis
 
 
À
23/10/2007 16:54:15
Sergio Ortiz
Tek Services Group, Llc
Hollywood, Floride, États-Unis
Information générale
Forum:
ASP.NET
Catégorie:
ADO.NET
Divers
Thread ID:
01262924
Message ID:
01262925
Vues:
15
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/
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform