예제 #1
0
        private void btnagregarcliente_Click(object sender, EventArgs e)
        {
            if (txtnombre_Promotor.Text == "" || txtApellidoPa_Promotor.Text == "" || txtApellidoMa_Promotor.Text == "" || txtcomision.Text == "" || cbterrenos.SelectedIndex == 0)
            {
                MessageBox.Show("No puede dejar campos vacios", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                //Insertar datos
                string Res   = " ";
                string query = string.Format("insert into promotores(Clave_Terreno,Nombre_Promotor,Apellido_P,Apellido_M,Comision) " +
                                             "values('{0}', '{1}', '{2}','{3}',{4})", cbterrenos.Text, txtnombre_Promotor.Text, txtApellidoPa_Promotor.Text, txtApellidoMa_Promotor.Text, txtcomision.Text);
                MySqlCommand com = new MySqlCommand(query, conexion._conexion);
                try
                {
                    conexion._conexion.Open();
                    com.ExecuteNonQuery();
                    Res = "Datos guardados exitosamente.";
                    conexion._conexion.Close();
                }
                catch (Exception ex)
                {
                    Res = ex.Message;
                    conexion._conexion.Close();
                }

                MessageBox.Show(Res, "Ha ocurrido un error.");


                this.Hide();
                Promotores p = new Promotores();
            }
        }
예제 #2
0
        private void btncancelarcliente_Click(object sender, EventArgs e)
        {
            this.Hide();
            Promotores p = new Promotores();

            ;
        }