Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Problem updating Inserted row in my DataSet
Message
De
24/10/2007 11:07:20
Sergio Ortiz
Tek Services Group, Llc
Hollywood, Floride, États-Unis
 
 
À
24/10/2007 10:49:59
Mike Cole
Yellow Lab Technologies
Stanley, Iowa, États-Unis
Information générale
Forum:
ASP.NET
Catégorie:
ADO.NET
Divers
Thread ID:
01262924
Message ID:
01263128
Vues:
18
Are you using a Stored Procedure or direct table access?

Table.

My UI recieves a dataset, then I insert a row into my table.:
private void btnSave_Click(object sender, EventArgs e)
        {
            if (this.rtbNotes.Text.Length > 0)
            {
                DataRow row =  this.dsPolicyNotes.Tables[0].NewRow();
                row["PolID"] = this.PolID;
                row["Note"] = this.rtbNotes.Text;
                row["edate"] = DateTime.Now;
                row.EndEdit();
                this.dsPolicyNotes.Tables[0].Rows.Add(row);
                this.oPolicyNotesBiz.UpdateDataSet(dsPolicyNotes);
            }
        }
Then I passes it to my Biz layer and then my Biz layer pass it to my DataAccess layer. My data access layer is trying to commit the changes to SQL Server. Here is the code:
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();
 }
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform