public static bool UpdateEnrolInfo(EnrolInfo Info) { StringBuilder sql = new StringBuilder(); sql.Append(" UPDATE [TEnrolInfo] SET "); sql.AppendFormat(" EnrolName='{0}',", Info.EnrolName); sql.AppendFormat(" EnrolSex='{0}',", Info.EnrolSex); sql.AppendFormat(" EnrolBirthday='{0}',", Info.EnrolBirthday); sql.AppendFormat(" EnrolWorkYear='{0}',", Info.EnrolWorkYear); sql.AppendFormat(" EnrolTel='{0}',", Info.EnrolTel); sql.AppendFormat(" EnrolTeacherTitle='{0}',", Info.EnrolTeacherTitle); sql.AppendFormat(" EnrolSubject={0},", Info.EnrolSubject); sql.AppendFormat(" SchoolID={0} ", Info.SchoolID); sql.AppendFormat(" WHERE EnrollID={0};", Info.EnrollID); try { DbHelperSQL.ExecuteSqlInsert(sql.ToString()); } catch (Exception ex) { throw new Exception(ex.Message); } return(true); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { UserNo = UrlHtmlUtil.GetUserNo(); updateEnrolInfo = new EnrolInfo(); BindDataToSchoolList(UserNo); //绑定学校下拉列表 BindDataByReview(); BindDataToSubjectList(); //绑定学科下拉列表 } }
public static bool AddEnrolInfo(EnrolInfo Info) { string sql = "insert into TEnrolInfo (EnrolName,EnrolSex,EnrolBirthday,EnrolWorkYear,EnrolTel,EnrolTeacherTitle,EnrolSubject,SchoolID)"; sql += " values('" + Info.EnrolName + "','" + Info.EnrolSex + "','" + Info.EnrolBirthday + "','" + Info.EnrolWorkYear + "','" + Info.EnrolTel + "','" + Info.EnrolTeacherTitle + "'," + Info.EnrolSubject + "," + Info.SchoolID + ")"; try { DbHelperSQL.ExecuteSqlInsert(sql); } catch (Exception ex) { throw new Exception(ex.Message); } return(true); }
protected void Btn_Submit_Click(object sender, EventArgs e) { EnrolInfo myEnrolInfo = new EnrolInfo(); myEnrolInfo.SchoolID = Convert.ToInt32(DropList_School.Text); //学校ID myEnrolInfo.EnrolName = Tbx_Name.Text.Trim(); //姓名 myEnrolInfo.EnrolSex = DropList_Sex.SelectedItem.Text; //性别 myEnrolInfo.EnrolBirthday = Tbx_Birthday.Text.Trim(); //出生年月 myEnrolInfo.EnrolTeacherTitle = Tbx_Title.Text.Trim(); //职称 myEnrolInfo.EnrolSubject = Convert.ToInt32(DropList_Subject.Text); //学科 myEnrolInfo.EnrolWorkYear = Tbx_WorkYear.Text.Trim(); //教龄 myEnrolInfo.EnrolTel = Tbx_Tel.Text.Trim(); //联系电话 if (UrlHtmlUtil.AddEnrolInfo(myEnrolInfo)) { initText(); Response.Write("<script>alert('添加成功!')</script>"); BindDataByReview(); } }