crud de variante terminado, tal vez con detalles
This commit is contained in:
@@ -1862,6 +1862,37 @@ namespace compabetov2.database
|
||||
}
|
||||
}
|
||||
|
||||
public static bool editarVarianteDAO(Variante variante)
|
||||
{
|
||||
var db_conexion = new Conexion();
|
||||
try
|
||||
{
|
||||
SQLiteConnection conexion = db_conexion.get_connection();
|
||||
conexion.Open();
|
||||
|
||||
string sql = "UPDATE variantes SET nombre = @nombre, precio = @precio, cantidad = @cantidad, img = @img, " +
|
||||
"fk_producto = @fk_producto, precioCompra = @precioCompra WHERE idVariante = @idVariante; ";
|
||||
|
||||
|
||||
SQLiteCommand command = new SQLiteCommand(sql, conexion);
|
||||
command.Parameters.AddWithValue("@nombre", variante.nombre);
|
||||
command.Parameters.AddWithValue("@precio", variante.precio);
|
||||
command.Parameters.AddWithValue("@cantidad", variante.cantidad);
|
||||
command.Parameters.AddWithValue("@img", variante.img);
|
||||
command.Parameters.AddWithValue("@fk_producto", variante.fkProducto);
|
||||
command.Parameters.AddWithValue("@precioCompra", variante.precioCompra);
|
||||
command.Parameters.AddWithValue("@idVariante", variante.idVariante);
|
||||
command.ExecuteNonQuery();
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (SQLiteException ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static SQLiteDataReader conseguirImportesDAO()
|
||||
{
|
||||
SQLiteDataReader reader = null;
|
||||
|
||||
Reference in New Issue
Block a user