Example #1
0
        public static int Agregar(Campos CCampos)
        {
            int retorno = 0;

            using (SqlConnection conn = Conexion.obtenerconexion())
            {
                conn.Open();
                SqlCommand Comando = new SqlCommand(String.Format("Insert Into Clientes (Nombre,Apellido, Cedula, Telefono ,ESTADO) values ('{0}','{1}','{2}','{3}','ACTIVADO')",
                                                                  CCampos.Nombres, CCampos.Apellido, CCampos.Cedula, CCampos.Telefono, CCampos.Estado), conn);
                retorno = Comando.ExecuteNonQuery();
                conn.Close();
            }
            return(retorno);
        }
Example #2
0
        void G()
        {
            Campos cc = new Campos();

            cc.Nombres  = textBox2.Text;
            cc.Apellido = textBox3.Text;
            cc.Cedula   = textBox4.Text;
            cc.Telefono = textBox5.Text;

            int resultado = CAMPOIN1.Agregar(cc);

            if (resultado > 0)
            {
                MessageBox.Show("El Registro ha sido guardado correctamente!!", "ImformaciĆ³n importante", MessageBoxButtons.OK, MessageBoxIcon.Exclamation
                                );
            }
        }
Example #3
0
        void Modificar()
        {
            using (SqlConnection conn = Conexion.obtenerconexion())
            {
                conn.Open();
                SqlCommand hh = new SqlCommand("UPDATE Clientes SET Nombre='" + this.textBox2.Text + "',Apellido='" + this.textBox3.Text + "',Cedula='" + this.textBox4.Text + "',Telefono='" +
                                               this.textBox5.Text + "' WHERE Id_Cliente= " + Convert.ToInt64(this.textBox1.Text + ""), conn);
                hh.BeginExecuteNonQuery();
                MessageBox.Show("El registro ha sido actualizado correctamente!!", "InformaciĆ³n importante", MessageBoxButtons.OK, MessageBoxIcon.Exclamation
                                );
                conn.Close();

                Campos cc = new Campos();

                cc.Nombres  = textBox2.Text;
                cc.Apellido = textBox3.Text;
                cc.Cedula   = textBox4.Text;
                cc.Telefono = textBox5.Text;
            }
        }