public static void insertarCCBKgeneral(MySqlConnection conexion, CCBKGeneral cc1) { String query = "INSERT INTO ccbkgeneral(IDESTABLECIMIENTO, MES, AÑO, SR+, SRTOTAL, BKDX, BKTX, BKTX+, BKDX+PORCENTAJE, BKDX-, BKTK+) VALUES ('" + cc1.idEstablecimiento + "','" + cc1.Mes + "','" + cc1.Año + "','" + cc1.SR + "','" + cc1.SRTotal + "','" + cc1.BKDX + "','" + cc1.BKTX + "','" + cc1.BKDXmas + "','" + cc1.BKDXmaspor + "','" + cc1.BKDXmenos + "','" + cc1.BKTXmas + "')"; 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.CCBKGeneral cc1 = new Clases.CCBKGeneral(Convert.ToInt32(cbesta.SelectedValue), comboBox1.Text, comboBox2.Text, Convert.ToInt32(textBox8.Text), Convert.ToInt32(textBox3.Text), Convert.ToInt32(textBox5.Text), Convert.ToInt32(textBox2.Text), Convert.ToInt32(textBox1.Text), Convert.ToInt32(textBox9.Text), Convert.ToInt32(textBox4.Text), Convert.ToInt32(textBox6.Text), Convert.ToInt32(textBox7.Text)); Clases.CCBKGeneral.insertarCCBKgeneral(con.conexion, cc1); MessageBox.Show("Consolidado Ingresado Exitosamente"); } } catch (MySqlException ex) { MessageBox.Show("Error al insertar el consolidado" + ex); } con.desconectar(); }