private void BtnSave_Click(object sender, System.EventArgs e) { if (TXTxbmc.Text == "") { Response.Write("<script>alert('系部名称不能为空!')</script>"); return; } MyMethods mm = new MyMethods(); string strid = mm.DateId(); string sql = "insert into 系部 values ('" + strid + "','" + TXTxbmc.Text + "')"; new MyData(Application["connstr"].ToString()).eInsertUpdateDelete(sql); TXTxbmc.Text = ""; mm.DG_bind(Dg_xb, "select * from 系部", "", "", Application["connstr"].ToString()); Response.Write("<script>alert('添加成功!')</script>"); }
private void BtnSaveBj_Click(object sender, System.EventArgs e) { if (TXTbjmc.Text == "") { Response.Write("<script>alert('班级名称不能为空!')</script>"); return; } MyMethods mm = new MyMethods(); string strid = mm.DateId(); string sql = "insert into 班级(id,班级名称,系部编号) values ('" + strid + "','" + TXTbjmc.Text + "','" + Dg_xb.DataKeys[Dg_xb.SelectedIndex] + "')"; new MyData(Application["connstr"].ToString()).eInsertUpdateDelete(sql); TXTbjmc.Text = ""; string strsql = "select * from 班级 where 系部编号='" + Convert.ToString(Dg_xb.DataKeys[Dg_xb.SelectedIndex]) + "'"; mm.DG_bind(Dg_bj, strsql, "", "", Application["connstr"].ToString()); Response.Write("<script>alert('添加成功!')</script>"); }