protected void GridView3_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "cancel") { DateTime endtime = DateTime.Parse(e.CommandArgument.ToString().Split(new string[] { ",," }, StringSplitOptions.RemoveEmptyEntries)[1].Trim()); //超過三天的租借記錄無法取消 if (DateTime.Now.AddDays(-3) < endtime) { JuicDao dao = new JuicDao("MENU"); dao.DeleteConferenceroom(e.CommandArgument.ToString().Split(new string[] { ",," }, StringSplitOptions.RemoveEmptyEntries)[0].Trim()); Label2.Text = "已取消此租借"; } else { Label2.Text = "超過三天之租借記錄無法取消"; } } }