private void button4_Click(object sender, EventArgs e) { if (validation() == 0) { errorProvider1.Clear(); con.Open(); SqlCommand cmd = con.CreateCommand(); cmd.CommandType = CommandType.Text; cmd.CommandText = "insert into sale_order values ('" + textBox8.Text + "','" + textBox11.Text + "','" + textBox2.Text + "','" + this.dateTimePicker1.Text + "','" + textBox3.Text + "','" + textBox4.Text + "','" + textBox5.Text + "','" + textBox6.Text + "','" + textBox7.Text + "','" + textBox10.Text + "')"; //cmd.CommandText = "update vehicle set v_quantity = v_quantity - '" + textBox6.Text + "' where v_id = '" + textBox2.Text + "'"; cmd.ExecuteNonQuery(); con.Close(); con.Open(); SqlCommand cmd1 = con.CreateCommand(); cmd1.CommandType = CommandType.Text; //cmd.CommandText = "insert into sale_order values ('" + textBox8.Text + "','" + textBox11.Text + "','" + textBox2.Text + "','" + textBox3.Text + "','" + textBox4.Text + "','" + textBox5.Text + "','" + textBox6.Text + "','" + textBox7.Text + "','" + textBox10.Text + "')"; cmd1.CommandText = "update vehicle set v_quantity = v_quantity - '" + textBox6.Text + "' where v_id = '" + textBox2.Text + "'"; cmd1.ExecuteNonQuery(); con.Close(); MessageBox.Show("Added to cart !"); diplay_data(); this.Close(); sale_order so = new sale_order(); so.Show(); } }
private void saleOrderToolStripMenuItem_Click(object sender, EventArgs e) { sale_order sm = new sale_order(); sm.Show(); }