using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data; using System.Data.OleDb; using System.Data.Sql; using System.Data.SqlClient; public partial class Modify : System.Web.UI.Page { LYS.UserData1 myud = new LYS.UserData1(); protected void Page_Load(object sender, EventArgs e) { //用Session保存当前页 if (Session["Username"] == null) { Response.Redirect("LoginNew.aspx"); } TextBox1.Text = Session["Username"].ToString(); int ID = Convert.ToInt16(Request.QueryString["ID"].ToString()); string myURL = myud.GetAddressUrl().ToString(); if (myURL.LastIndexOf("ID") < 0) { Response.Write(""); Response.End(); } if (!IsPostBack) { TextBox1.Text = myud.GetFieldValue(4, ID, "TKJL").ToString(); ZJ.Text = Convert.ToDateTime(myud.GetFieldValue(5, ID, "TKJL").ToString()).ToShortDateString(); DD.Text = myud.GetFieldValue(9, ID, "TKJL").ToString(); JSXM.Text = myud.GetFieldValue(1, ID, "TKJL").ToString(); XB.Text = myud.GetFieldValue(2, ID, "TKJL").ToString(); KM.Text = myud.GetFieldValue(3, ID, "TKJL").ToString(); BJ.Text = myud.GetFieldValue(6, ID, "TKJL").ToString(); XQ.Text = myud.GetFieldValue(7, ID, "TKJL").ToString(); TextBox2.Text = myud.GetFieldValue(10, ID, "TKJL").ToString(); JC.Text = myud.GetFieldValue(8, ID, "TKJL").ToString(); PF.Text = myud.GetFieldValue(13, ID, "TKJL").ToString(); PJ.Text = myud.GetFieldValue(11, ID, "TKJL").ToString(); } } protected void Button1_Click(object sender, EventArgs e) { int ID =Convert.ToInt16(Request.QueryString["ID"].ToString()); if (DD.Text.Trim().Length == 0 || JSXM.Text.Trim().Length == 0 || BJ.Text.Trim().Length == 0 || KM.Text.Trim().Length == 0 || PF.Text.Trim().Length == 0) { Response.Write(""); } else { //string connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + HttpContext.Current.Server.MapPath("~\\App_Data\\ZY.mdb"); string connectionString = myud.ConnString(); //检查是否有同样sql="SELECT * FROM Pengfeng where csid="&request.Form("CSID")&" and 评价人='"&request.Form("MyName1")&"' and 评价组='"&request.Form("MyName2")&"'" string sql = "select * from TKJL where 督导姓名='" + TextBox1.Text.Trim() + "' and 课程名='" + KM.Text.Trim() + "' and 教师姓名='" + JSXM.Text.Trim() + "' and 听课日期=#" + Convert.ToDateTime(ZJ.Text.Trim()).ToShortDateString() + "#"; string sql1 ="select * from TKJL where id=" + Convert.ToInt16(Request.QueryString["ID"].ToString()); myud.UpdateStringFieldValue("TKJL", "教师姓名", JSXM.Text, ID); myud.UpdateStringFieldValue("TKJL", "系部", XB.Text, ID); myud.UpdateStringFieldValue("TKJL", "课程名", KM.Text, ID); myud.UpdateStringFieldValue("TKJL", "督导姓名", TextBox1.Text, ID); myud.UpdateStringFieldValue("TKJL", "听课日期", ZJ.Text, ID); myud.UpdateStringFieldValue("TKJL", "班级", BJ.Text, ID); myud.UpdateStringFieldValue("TKJL", "星期", XQ.Text, ID); myud.UpdateStringFieldValue("TKJL", "节次", JC.Text, ID); myud.UpdateStringFieldValue("TKJL", "上课地点", DD.Text, ID); myud.UpdateStringFieldValue("TKJL", "情况记录", TextBox2.Text, ID); myud.UpdateStringFieldValue("TKJL", "点评评价", PJ.Text, ID); myud.UpdateStringFieldValue("TKJL", "总评分", PF.Text, ID); Response.Write(""); //ZJ.Text = Convert.ToDateTime(myud.GetFieldValue(5, ID, "TKJL").ToString()).ToShortDateString(); //DD.Text = myud.GetFieldValue(9, ID, "TKJL").ToString(); //JSXM.Text = myud.GetFieldValue(1, ID, "TKJL").ToString(); //XB.Text = myud.GetFieldValue(2, ID, "TKJL").ToString(); //KM.Text = myud.GetFieldValue(3, ID, "TKJL").ToString(); //BJ.Text = myud.GetFieldValue(6, ID, "TKJL").ToString(); //XQ.Text = myud.GetFieldValue(7, ID, "TKJL").ToString(); //JC.Text = myud.GetFieldValue(8, ID, "TKJL").ToString(); //PF.Text = myud.GetFieldValue(28, ID, "TKJL").ToString(); //PJ.Text = myud.GetFieldValue(26, ID, "TKJL").ToString(); } } }