private void button2_Click(object sender, EventArgs e) { try { SqlConnection con = new SqlConnection(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=I:\C3 soft\WindowsFormsApplication2\WindowsFormsApplication2\MTechSqlDatabase.mdf;Integrated Security=True;Connect Timeout=30"); con.Open(); string cb = string.Format("Update UnitType set UnitType='{0}' where UnitTypeID='{1}'", textBox2.Text,textBox1.Text ); SqlCommand cmd = new SqlCommand(cb, con); cmd.ExecuteReader(); con.Close(); MessageBox.Show("Successfully update"); GetData(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
MM Online Express | Best product Review and Online Marketing site
private void button2_Click(object sender, EventArgs e)
ReplyDelete{
try
{
SqlConnection con = new SqlConnection(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=I:\C3 soft\WindowsFormsApplication2\WindowsFormsApplication2\MTechSqlDatabase.mdf;Integrated Security=True;Connect Timeout=30");
con.Open();
string cb = string.Format("Update UnitType set UnitType='{0}' where UnitTypeID='{1}'", textBox2.Text,textBox1.Text );
SqlCommand cmd = new SqlCommand(cb, con);
cmd.ExecuteReader();
con.Close();
MessageBox.Show("Successfully update");
GetData();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}