busqueda de productos

This commit is contained in:
carlos
2024-01-31 21:06:44 -06:00
parent 50722c2234
commit b7bfa356a2
7 changed files with 56 additions and 8 deletions
+25
View File
@@ -1483,6 +1483,31 @@ namespace compabetov2.database
}
}
public static SQLiteDataReader conseguirProductosFiltradosDAO(string nombreProducto)
{
SQLiteDataReader reader = null;
var db_conexion = new Conexion();
try
{
SQLiteConnection conexion = db_conexion.get_connection();
conexion.Open();
string sql = "SELECT * FROM Producto WHERE nombre LIKE @nombre";
SQLiteCommand command = new SQLiteCommand(sql, conexion);
command.Parameters.AddWithValue("@nombre", $"%{nombreProducto}%");
reader = command.ExecuteReader();
return reader;
}
catch (SQLiteException ex)
{
MessageBox.Show(ex.Message);
return reader;
}
}
private static void crearDB()
{
var db_conexion = new Conexion();