コード例 #1
0
ファイル: Nivel_registrar.cs プロジェクト: bauthista/Gestion2
        public static int Agregar(Nivel__code_constructores variable)
        {
            int retorno = 0;

            MySqlCommand comando = new MySqlCommand(string.Format("Insert into Nivel (idNivel,Nombre_Nivel) values ('{0}','{1}')",
                                                                  variable.idNivel, variable.Nombre_nivel), Bdconexion.ObtenerConexion());

            retorno = comando.ExecuteNonQuery();
            return(retorno);
        }
コード例 #2
0
        private void button2_Click(object sender, EventArgs e)
        {
            Nivel__code_constructores variables = new Nivel__code_constructores();

            variables.Nombre_nivel = Cmbnivel.Text.Trim();


            int resultado = Nivel_registrar.Agregar(variables);

            if (resultado > 0)
            {
                MessageBox.Show("Alumno Guardado Con Exito!!", "Guardado", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.Hide();
            }
            else
            {
                MessageBox.Show("No se pudo guardar el Alumno", "Fallo!!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                this.Hide();
            }
        }