Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. string QueryCon = "SELECT Id_Categoria FROM Categoria where Nombre='" + Categoria + "'";
  2. connection.Close();
  3. connection.Open();
  4. MySqlCommand ConnCombo = new MySqlCommand(QueryCon, connection);
  5. MySqlDataReader reader = ConnCombo.ExecuteReader();
  6. while (reader.Read())
  7. {
  8. Id_C = int.Parse(reader.GetString("Id_Categoria"));
  9. }
  10.  
  11. string query = "INSERT INTO compra (Articulo, Categoria,Importancia,Obligatorio,Costo,Descripcion,Adquirir) VALUES('" + Articulo + "', '" + Id_C + "'," + Importancia + ",'no'," + Costo + ",'" + Descripcion + "','No','" + Mes + "')";
  12.  
  13. if (aprobar==true) {
  14. //create command and assign the query and connection from the constructor
  15. MySqlCommand cmd = new MySqlCommand(query, connection);
  16.  
  17. //Execute command
  18. cmd.ExecuteNonQuery(); ------- Error
  19.  
  20. connection.Close();
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement