public static void insertarPruebaGX(MySqlConnection conexion, PruebaGX ipgx) { String query = "INSERT INTO gx( IDPRUEBA, FECHAINDICACION, IDMOTIVOINDICACIONGX, IDRESULTADOGX, FECHARESULTADO) VALUES ('" + ipgx.idprueba + "' , '" + ipgx.fechaindicacion + "', '" + ipgx.idmotivoindicaciongx + "' , '" + ipgx.idresultadogx + "', '" + ipgx.fecharesultado + "' )"; try { MySqlCommand comando = new MySqlCommand(query, conexion); Int32 lector = (Int32)comando.ExecuteNonQuery(); } catch (MySqlException ex) { throw ex; } }
private void buttonguardar_Click(object sender, EventArgs e) { try { if (con.conectar()) { Clases.Prueba ip = new Clases.Prueba(Convert.ToInt32(label4), 1); Clases.Prueba.ingresarprueba(con.conexion, ip); Clases.PruebaGX ipbk = new Clases.PruebaGX( ); Clases.PruebaGX.insertarPruebaGX(con.conexion, ipbk); MessageBox.Show("Muestra Ingresada Exitosamente"); } } catch (MySqlException ex) { MessageBox.Show("Error al insertar la muestra" + ex); } con.desconectar(); }