private void textBox2_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e) { if (e.KeyData == Keys.Enter) { if (isvalid()) { con1.Open(); SqlCommand com2 = new SqlCommand(); com2.Connection = con1; com2.CommandText = "SELECT * FROM Venodor WHERE VID='" + comboBox1.Text.Trim() + "'"; SqlDataReader dr = com2.ExecuteReader(); if (dr.Read()) { com2.CommandText = "UPDATE Venodor SET CompanyName='" + comboBox2.Text.Trim() + "',Address='" + textBox3.Text.Trim() + "',Tel1='" + textBox4.Text.Trim() + "',Tel2='" + textBox1.Text.Trim() + "',Fax='" + textBox5.Text.Trim() + "',Mail='" + textBox6.Text.Trim() + "',Acc='" + textBox7.Text.Trim() + "',Extra='" + textBox8.Text.Trim() + "',Type= '" + textBox9.Text.Trim() + "' ,Loan='" + textBox2.Text.Trim() + "' WHERE VID='" + comboBox1.Text.Trim() + "' "; dr.Close(); com2.ExecuteNonQuery(); MessageBox.Show("Updated"); } else { MessageBox.Show("Invalid Vendor", "Error"); } con1.Close(); Update_Vendor uv = new Update_Vendor(); this.Hide(); uv.Show(); } } }
private void newToolStripButton_Click_1(object sender, EventArgs e) { Update_Vendor v = new Update_Vendor(); v.Show(); this.Hide(); }
private void toolStripLabel2_Click_1(object sender, EventArgs e) { Update_Vendor uv = new Update_Vendor(); uv.Show(); this.Hide(); }
private void vendorToolStripMenuItem1_Click(object sender, EventArgs e) { Update_Vendor vu = new Update_Vendor(); vu.Show(); }