Beispiel #1
0
        private void btnGuardar_Click(object sender, RoutedEventArgs e)
        {
            //Insertar
            BoyacaDataContext contexto = new BoyacaDataContext("isostore:/boyaca.mdb");

            Items nuevo = new Items();
            nuevo.Nombre = txtDescripcion.Text;
            nuevo.Precio = Convert.ToInt32(this.txtPrecio.Text);

            contexto.Items.InsertOnSubmit(nuevo);
            contexto.SubmitChanges();

            //Consultar todos

            List<Items> todos = (from i in contexto.Items
                                select i).ToList();

            //Consultar uno y actualizar
            Items uno = (from i in contexto.Items
                         where i.Id == 1
                         select i).SingleOrDefault();

            uno.Nombre = this.txtDescripcion.Text;
            uno.Precio = Convert.ToInt32(this.txtPrecio.Text);

            contexto.SubmitChanges();

            //Borrar
            Items otro = (from i in contexto.Items
                         where i.Id == 1
                         select i).SingleOrDefault();

            contexto.Items.DeleteOnSubmit(otro);
            contexto.SubmitChanges();





        }
Beispiel #2
0
 partial void UpdateItems(Items instance);
Beispiel #3
0
 partial void DeleteItems(Items instance);
Beispiel #4
0
 partial void InsertItems(Items instance);