日期:2014-05-17 浏览次数:20415 次
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())+"'"); }