private void FormularioConectado_Load(object sender, EventArgs e) { var context = new AWEntities(); var query = from c in context.tblRegClientes where c.sCedula != "0" select c; tblRegClienteBindingSource.DataSource = query.ToList(); }
private void ConsultaEntity() { var context = new AWMOdel.AWEntities(); var query = from c in context.tblTipos_Instrumentos where c.iTipoInstrumento == 0 select new {c.sDescripcion }; var tiposI = query.ToList(); foreach (var valor in tiposI) { lstBox1.Items.Add(valor.sDescripcion.ToString()); } }
private void DeleteEntity() { using (var context = new AWMOdel.AWEntities()) { var query = from f in context.tblTipos_Instrumentos where f.sDescripcion == "Descripcion Insertada Entity" select f; foreach(var order in query) { context.tblTipos_Instrumentos.Remove(order); } context.SaveChanges(); } }
private void UpdateEntity() { using(var context = new AWMOdel.AWEntities()) { var query = context.tblTipos_Instrumentos.First(c => c.iTipoInstrumento == 0); query.sDescripcion = "Updated By Entity F"; context.SaveChanges(); } }
private void InsertEntity() { using (var context = new AWMOdel.AWEntities()) { tblTipos_Instrumentos ins = new tblTipos_Instrumentos(); ins.iSubtipo = 5; ins.iTipoInstrumento = 0; ins.sDescripcion = "Nuevo Insert Entity"; context.tblTipos_Instrumentos.Add(new tblTipos_Instrumentos { sDescripcion = "Descripcion Insertada Entity t", iTipoInstrumento = 0, iSubtipo = 4 }); context.tblTipos_Instrumentos.Add(ins); context.SaveChanges(); } }