Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- string QueryCon = "SELECT Id_Categoria FROM Categoria where Nombre='" + Categoria + "'";
- connection.Close();
- connection.Open();
- MySqlCommand ConnCombo = new MySqlCommand(QueryCon, connection);
- MySqlDataReader reader = ConnCombo.ExecuteReader();
- while (reader.Read())
- {
- Id_C = int.Parse(reader.GetString("Id_Categoria"));
- }
- string query = "INSERT INTO compra (Articulo, Categoria,Importancia,Obligatorio,Costo,Descripcion,Adquirir) VALUES('" + Articulo + "', '" + Id_C + "'," + Importancia + ",'no'," + Costo + ",'" + Descripcion + "','No','" + Mes + "')";
- if (aprobar==true) {
- //create command and assign the query and connection from the constructor
- MySqlCommand cmd = new MySqlCommand(query, connection);
- //Execute command
- cmd.ExecuteNonQuery(); ------- Error
- connection.Close();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement