← Tutti gli articoli

Entity Data Framework - Update a record through the primary key. EntityKey (namespace System.Data)

05 July 2010  ·  EDF · Article  ·  90 visite

Entity Data Framework - Update a record through the primary key. EntityKey (namespace System.Data)



ContraEntities contraEntityCtx = new ContraEntities(ConfigurationManager.ConnectionStrings["ContraCSEntities"].ToString());
int ID_SpidBustaPagaDettaglio = Convert.ToInt32(lbl_ID_SpidBustaPagaDettaglio_Save.Text);
bpd = contraEntityCtx.tbl_SpidBustaPagaDettaglio.Where(a => a.ID_SpidBustaPagaDettaglio == ID_SpidBustaPagaDettaglio).FirstOrDefault();
bpd.Descrizione = txtDescrizione.Text; int IDTemplateItem = Convert.ToInt32(ddlItemTemplate.SelectedValue);
bpd.tbl_TemplateItemsReference.EntityKey = new EntityKey("ContraEntities.tbl_TemplateItems", "IDTemplateItem", IDTemplateItem);
contraEntityCtx.SaveChanges();


Si è verificato un errore imprevisto. Ricarica

Rejoining the server...

Rejoin failed... trying again in seconds.

Failed to rejoin.
Please retry or reload the page.

The session has been paused by the server.

Failed to resume the session.
Please retry or reload the page.