如何通过单击datagridview
按钮来更新datagridview
行。
代码
Connect_Database.con.Close(); //opening connection
Connect_Database.con.Open(); //closing connection
string qry = "update checkin set Checkin_status =@Checkin_status where CheckIn_Code= '" + dgCheck_Out.SelectedRow.Cells [0].Value + "' ";
cmd = new SqlCommand(qry, Connect_Database.con);
cmd.Parameters.AddWithValue("@Checkin_status", "Check Out");
int row = cmd.ExecuteNonQuery();
if (row > 0)
{
MessageBox.Show(string.Format("Guest Sucessfully Checked Out");
}