Ejemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            connection.Open();
            SqlCommand cmd = connection.CreateCommand();

            cmd.CommandType = CommandType.Text;
            cmd.CommandText = "update Bicicleta set Pret='" + textBox2.Text + "' where Model='" + textBox1.Text + "'";
            cmd.ExecuteNonQuery();
            connection.Close();
            form1.display_data();
            MessageBox.Show("Pretul bicicletei a fost actualizat.");
        }
Ejemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            connection.Open();
            SqlCommand cmd = connection.CreateCommand();

            cmd.CommandType = CommandType.Text;
            cmd.CommandText = "insert into Bicicleta values('" + textBox1.Text + "','" + textBox2.Text + "','" + textBox3.Text + "','" + textBox4.Text + "','" + textBox5.Text + "')";
            cmd.ExecuteNonQuery();
            connection.Close();
            form1.display_data();
            textBox1.Text = "";
            textBox2.Text = "";
            textBox3.Text = "";
            textBox4.Text = "";
            textBox5.Text = "";
            MessageBox.Show("Bicicleta a fost adaugata.");
        }