Guest User

Untitled

a guest
Jun 20th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1. // ELIMINA LA FILA DE ESE PRODUCTO AL HACER CLICK EN EL BOTON "BORRAR"
  2. // FUNCION A ARREGLAR (BORRA MAS DE LO NECESARIO)
  3. private void Pagos_CellClick(object sender, DataGridViewCellEventArgs e)
  4. {
  5. if (this.Pagos.Columns[e.ColumnIndex].Name == "colBotones")
  6. {
  7. string mesa = this.numMesa;
  8. int id_producto = Convert.ToInt32(txtID.Text.ToString());
  9. string nombre = txtNombre.Text.ToString();
  10. double precio = Convert.ToDouble(txtPrecio.Text.ToString());
  11. double cantidad = Convert.ToDouble(txtCantidad.Text.ToString());
  12. double subtotal = Convert.ToDouble(etiquetaSubTotalNum.Text.ToString());
  13.  
  14. String consulta = "DELETE FROM Productos where mesa = @mesa and id_producto = @id_producto and nombre = @nombre and precio = @precio and cantidad = @cantidad and subtotal = @subtotal";
  15. SQLiteCommand cmd = new SQLiteCommand(consulta, conexion);
  16.  
  17. cmd.Parameters.Clear();
  18. cmd.Parameters.Add(new SQLiteParameter("@mesa", mesa));
  19. cmd.Parameters.Add(new SQLiteParameter("@id_producto", id_producto));
  20. cmd.Parameters.Add(new SQLiteParameter("@nombre", nombre));
  21. cmd.Parameters.Add(new SQLiteParameter("@precio", precio));
  22. cmd.Parameters.Add(new SQLiteParameter("@cantidad", cantidad));
  23. cmd.Parameters.Add(new SQLiteParameter("@subtotal", subtotal));
  24. cmd.ExecuteNonQuery();
  25.  
  26. Pagos.Rows.RemoveAt(Pagos.CurrentRow.Index);
  27.  
  28. }
  29. }
Add Comment
Please, Sign In to add comment