carta para productos

This commit is contained in:
carlos
2024-01-04 21:28:22 -06:00
27 changed files with 415 additions and 521 deletions
+2 -3
View File
@@ -147,8 +147,8 @@ namespace compabetov2.database
var db_conexion = new Conexion();
try
{
using (SQLiteConnection conexion = db_conexion.get_connection())
{
SQLiteConnection conexion = db_conexion.get_connection();
conexion.Open();
string sql = "SELECT * FROM Producto INNER JOIN Categoria ON Producto.fk_idcategoria = Categoria.idcategoria";
@@ -156,7 +156,6 @@ namespace compabetov2.database
reader = command.ExecuteReader();
return reader;
}
}
catch (SQLiteException ex) {
MessageBox.Show(ex.Message);
+4 -4
View File
@@ -26,17 +26,17 @@ namespace compabetov2.database
while (reader.Read())
{
Categoria categoria = new Categoria(
(int)reader["idcategoria"],
int.Parse(reader["idcategoria"].ToString()),
reader["nombre"].ToString(),
reader["descripcion"].ToString());
Producto producto = new Producto(
(int)reader["idproducto"],
int.Parse(reader["idproducto"].ToString()),
reader["nombre"].ToString(),
reader["descripcion"].ToString(),
(decimal)reader["precio"],
decimal.Parse(reader["precio"].ToString()),
reader["img"].ToString(),
(int)reader["stock"],
int.Parse(reader["stock"].ToString()),
categoria);
productos.Add(producto);