Esempio n. 1
0
        private void pictureBox1_Click(object sender, EventArgs e)
        {
            int restador;

            restador = Convert.ToInt16(textBox1.Text);
            if (restador == 1)
            {
                MessageBox.Show("Estas al inicio");
            }
            else
            {
                restador = restador - 1;
            }
            textBox1.Text = Convert.ToString(restador);
            textBox2.Clear();
            textBox3.Clear();
            textBox4.Clear();
            textBox5.Clear();
            OleDbConnection ole = new OleDbConnection();

            ole = Base_Datos.conectar();
            OleDbCommand cmd = new OleDbCommand();

            cmd.Connection  = ole;
            cmd.CommandText = "SELECT * FROM Tabla_Usuarios WHERE Id=" + textBox1.Text;
            OleDbDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                textBox2.Text = textBox2.Text + reader.GetValue(0).ToString() + "\r\n";
                textBox3.Text = textBox3.Text + reader.GetValue(1).ToString() + "\r\n";
                textBox4.Text = textBox4.Text + reader.GetValue(2).ToString() + "\r\n";
                textBox5.Text = textBox5.Text + reader.GetValue(3).ToString() + "\r\n";
            }
        }
Esempio n. 2
0
        private void Datos_Load(object sender, EventArgs e)
        {
            OleDbConnection ole = new OleDbConnection();

            ole = Base_Datos.conectar();
            OleDbCommand cmd = new OleDbCommand();

            cmd.Connection  = ole;
            cmd.CommandText = "SELECT * FROM Tabla_Usuarios";
            OleDbDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                textBox1.Text = textBox1.Text + reader.GetValue(0).ToString() + "\r\n";
                textBox2.Text = textBox2.Text + reader.GetValue(1).ToString() + "\r\n";
                textBox3.Text = textBox3.Text + reader.GetValue(2).ToString() + "\r\n";
                textBox4.Text = textBox4.Text + reader.GetValue(3).ToString() + "\r\n";
            }
        }
Esempio n. 3
0
        private void button1_Click(object sender, EventArgs e)
        {
            OleDbConnection ole = new OleDbConnection();

            ole = Base_Datos.conectar();
            OleDbCommand cmd = new OleDbCommand();

            cmd.Connection = ole;

            DialogResult dialogResult = MessageBox.Show("Estas seguro?", "Advertencia", MessageBoxButtons.YesNo);

            if (dialogResult == DialogResult.Yes)
            {
                cmd.CommandText = "DELETE * FROM Tabla_Usuarios WHERE Id=" + textBox1.Text;
                OleDbDataReader reader = cmd.ExecuteReader();
                MessageBox.Show("Se borro con exito");
            }
            else if (dialogResult == DialogResult.No)
            {
            }
        }
Esempio n. 4
0
 private void button2_Click(object sender, EventArgs e)
 {
     Base_Datos.Desconectar();
 }