Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void Pagos_CellClick(object sender, DataGridViewCellEventArgs e)
- {
- if (this.Pagos.Columns[e.ColumnIndex].Name == "colBotones")
- {
- string mesa = this.numMesa.Trim();
- int id_producto = Convert.ToInt32(this.Pagos.Rows[e.RowIndex].Cells[0].Value.ToString());
- string nombre = Convert.ToString(this.Pagos.Rows[e.RowIndex].Cells[1].Value.ToString());
- double precio = Convert.ToDouble(this.Pagos.Rows[e.RowIndex].Cells[2].Value.ToString());
- double cantidad = Convert.ToDouble(this.Pagos.Rows[e.RowIndex].Cells[3].Value.ToString());
- double subtotal = Convert.ToDouble(this.Pagos.Rows[e.RowIndex].Cells[4].Value.ToString());
- 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 LIMIT 1";
- SQLiteCommand cmd = new SQLiteCommand(consulta, conexion);
- cmd.Parameters.Clear();
- cmd.Parameters.Add(new SQLiteParameter("@mesa", mesa));
- cmd.Parameters.Add(new SQLiteParameter("@id_producto", id_producto));
- cmd.Parameters.Add(new SQLiteParameter("@nombre", nombre));
- cmd.Parameters.Add(new SQLiteParameter("@precio", precio));
- cmd.Parameters.Add(new SQLiteParameter("@cantidad", cantidad));
- cmd.Parameters.Add(new SQLiteParameter("@subtotal", subtotal));
- cmd.ExecuteNonQuery();
- Pagos.Rows.RemoveAt(Pagos.CurrentRow.Index);
- }
- }
- private void Pagos_CellClick(object sender, DataGridViewCellEventArgs e)
- {
- if (this.Pagos.Columns[e.ColumnIndex].Name == "colBotones")
- {
- string mesa = this.numMesa.Trim();
- int id_producto = Convert.ToInt32(this.Pagos.Rows[e.RowIndex].Cells[0].Value.ToString());
- string nombre = Convert.ToString(this.Pagos.Rows[e.RowIndex].Cells[1].Value.ToString());
- double precio = Convert.ToDouble(this.Pagos.Rows[e.RowIndex].Cells[2].Value.ToString());
- double cantidad = Convert.ToDouble(this.Pagos.Rows[e.RowIndex].Cells[3].Value.ToString());
- double subtotal = Convert.ToDouble(this.Pagos.Rows[e.RowIndex].Cells[4].Value.ToString());
- 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 LIMIT 1";
- SQLiteCommand cmd = new SQLiteCommand(consulta, conexion);
- cmd.Parameters.Clear();
- cmd.Parameters.Add(new SQLiteParameter("@mesa", mesa));
- cmd.Parameters.Add(new SQLiteParameter("@id_producto", id_producto));
- cmd.Parameters.Add(new SQLiteParameter("@nombre", nombre));
- cmd.Parameters.Add(new SQLiteParameter("@precio", precio));
- cmd.Parameters.Add(new SQLiteParameter("@cantidad", cantidad));
- cmd.Parameters.Add(new SQLiteParameter("@subtotal", subtotal));
- cmd.ExecuteNonQuery();
- Pagos.Rows.RemoveAt(Pagos.CurrentRow.Index);
- }
- }
- Delete from table_name where rowid IN (Select rowid from table_name limit X);
Add Comment
Please, Sign In to add comment