// Delete Course protected void Delete_Click(object sender, EventArgs e) { TextBox CID = FindControl("CID") as TextBox; string cid = CID.Text; string std_id = myFunc.Get_ID("Select std_ID from Student where Session_ID = '" + (string)Session["ID"] + "'", 1); string pro_id = myFunc.Get_ID("Select pro_ID from Courses where CID= '" + cid + "';", 2); string adm_id = myFunc.Get_ID("Select adm_ID from Courses where CID='" + cid + "';", 3); if (!myFunc.Is_Course_Exist(cid)) { Response.Write("<script>alert('查無此課程 或 你根本沒選')</script>"); return; } if (std_id == null || pro_id == null || adm_id == null) { Response.Write("<script>alert('資料庫發生錯誤 歹勢啦')</script>"); return; } // 扣除人數 myFunc.Course_Amount_Minus(cid); // 學生:課程:教授 放入 課程池 string command = "DELETE FROM [dbo].[Course_Pool] WHERE (CID='" + cid + "' AND std_ID='" + std_id + "');"; SQL_cmd(command); myFunc.UPDATE_Total_Credit(std_id, cid, false); Response.Write("<script>alert('成功移除!')</script>"); CID.Text = ""; Response.Redirect("Select.aspx"); return; }