62,268
社区成员
发帖
与我相关
我的任务
分享
string id = Server.UrlDecode(Request.QueryString["id"].ToString().Trim()); //获取传值
string ClassName=TextBox1.Text.Trim();
string Adjoy=TextBox4.Text.Trim();
string year=TextBox5.Text.Trim();
string Manager=TextBox3.Text.Trim();
Sql.UpdateSql("update T_Class_Info set 班级名称='" + ClassName + "',所属专业='" + Adjoy + "',入学年份='" + year + "',班主任='" + Manager + "'where 班级编号='"+id+"'"); public static int UpdataSql(string sql)
{
SqlConnection SqlCon = new SqlConnection(ConfigurationManager.ConnectionStrings["ConStr"].ConnectionString);
SqlCon.Open();
SqlCommand SqlCom = new SqlCommand(sql, SqlCon);
return SqlCom.ExecuteNonQuery();
SqlCon.Close();
}
protected void Button1_Click(object sender, EventArgs e) { Sql.UpdataSql("update T_Class_Info set 班级名称='" + ClassName + "',所属专业='" + Adjoy + "',入学年份='" + year + "',班主任='" + Manager + "'where 班级编号='"+Server.UrlDecode(Request.QueryString["id"].ToString().Trim())+"'"); }
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
id = Server.UrlDecode(Request.QueryString["id"].ToString().Trim()); //获取传值
}
} protected void Button1_Click(object sender, EventArgs e)
{
Sql.UpdataSql("update T_Class_Info set 班级名称='" + ClassName + "',所属专业='" + Adjoy + "',入学年份='" + year + "',班主任='" + Manager + "'where 班级编号='"+id+"'");
}
