try
{
SqlConnection con = new SqlConnection(Connectionstring);
con.Open();
String sql = String.Format("update leavetable set status = '" + status + "' where eid = '" + textBox1.Text + "' and status = 'NULL'");
SqlCommand cmd = new SqlCommand(sql, con);
if (cmd.ExecuteNonQuery() == 1)
{
MessageBox.Show("status updated");
textBox1.Text = "";
textBox2.Text = "";
textBox3.Text = "";
textBox4.Text = "";
}
con.Close();
}
catch (Exception er)
{
MessageBox.Show(er.Message);
}
我在這裏顯示leavetable
細節到文本框的計算數量,我有radiobuttons
批准或取消的更新。如何當單選按鈕被選中了天
當管理員選擇批准的radiobutton
並點擊ok時,我想更新爲empid
批准的狀態,但empid不是主鍵。但是當我這樣做,它會更新所有具有EMPID作爲emp001
例如行
我不清楚什麼不是在你的代碼中工作? – HABJAN
這裏來的SQLi評論... –
是不是一個小時前問的幾乎相同的問題? http://stackoverflow.com/questions/24075036/update-command-is-not-working –