陈XX:三明学院班级电子信息档案管理系统设计与实现
protected void btn_add_Click(object sender, EventArgs e) {
string strconn = ConfigurationSettings.AppSettings[\]; SqlConnection conn = new SqlConnection(strconn); String sqlstr = \
student(stID,stName,sex,birthday,minZu,jiGuan,classID,enterTime,suShe,tel,homeAddress,mianMao,renZhi,teChang,beiZhu) values( '\ + TextBox1.Text.ToString() + \ + TextBox2.Text.ToString() + \ + TextBox3.Text.ToString() + \ + TextBox4.Text.ToString() + \ + TextBox5.Text.ToString() + \ + TextBox6.Text.ToString() + \ + Session[\] + \ + TextBox7.Text.ToString() + \ + TextBox8.Text.ToString() + \ + TextBox9.Text.ToString() + \ + TextBox10.Text.ToString() + \ + this.DropDownList1.SelectedItem.Text + \ + TextBox11.Text.ToString() + \ + TextBox12.Text.ToString() + \ + TextBox13.Text.ToString() + \; SqlCommand cmd = new SqlCommand(sqlstr, conn); conn.Open();
cmd.ExecuteNonQuery(); conn.Close();
Response.Write(\添加成功!!! '); \); } }
4. 班长添加积分
public partial class Class_Class_add_jifen : System.Web.UI.Page {
protected void Page_Load(object sender, EventArgs e) {
if (!Page.IsPostBack) {
Band_DropDownList1(); } }
protected void Band_DropDownList1() {
//绑定DropDownList1
string strconn = ConfigurationSettings.AppSettings[\]; SqlConnection conn = new SqlConnection(strconn);
SqlDataAdapter dap = new SqlDataAdapter(\, conn); DataTable dt = new DataTable(); dap.Fill(dt);
DropDownList1.DataSource = dt; DropDownList1.DataTextField = \; DropDownList1.DataValueField = \; DropDownList1.DataBind();
30
2011届网络工程班毕业设计
}
protected void ImageButton1_Click(object sender, ImageClickEventArgs e) {
string strconn = ConfigurationSettings.AppSettings[\]; SqlConnection conn = new SqlConnection(strconn); SqlCommand cmd3 = new SqlCommand(\
jifen.chengJi,jifen.avgScore,cePing,jiaJiang,yanCheng from student,jifen where
student.stID=jifen.stID and year='\ + DropDownList1.SelectedValue + \ + DropDownList3.SelectedValue + \+Session[\]+\, conn); conn.Open();
SqlDataReader dr3 = cmd3.ExecuteReader(CommandBehavior.CloseConnection); GridView1.DataSource = dr3; GridView1.DataBind();
string sqlstr = \stID,score.year,score.xueQi,sum(score*xueFen) cc ,0.7*sum(score*xueFen)/sum(xueFen) dd from course ,score where course.cID=score.cID group by stID,score.year,score.xueQi) b where jifen.stID=b.stID and jifen.year=b.year and jifen.xueQi=b.xueQi \; SqlCommand cmd = new SqlCommand(sqlstr, conn); conn.Open();
cmd.ExecuteNonQuery(); conn.Close(); }
protected void Button1_Click(object sender, EventArgs e) {
string strconn = ConfigurationSettings.AppSettings[\]; SqlConnection conn = new SqlConnection(strconn); foreach (GridViewRow gvr in GridView1.Rows) {
string txtCeping = ((TextBox)gvr.Cells[0].FindControl(\)).Text; string txtJiajiang = ((TextBox)gvr.Cells[0].FindControl(\)).Text; string txtYancheng = ((TextBox)gvr.Cells[0].FindControl(\)).Text; string id = gvr.Cells[0].Text;
String sqlstr = \ + txtCeping + \ + txtJiajiang + \ + txtYancheng + \ + id + \+DropDownList1.SelectedValue+\xueQi='\+DropDownList3.SelectedValue+\;
SqlCommand cmd = new SqlCommand(sqlstr, conn); conn.Open();
cmd.ExecuteNonQuery(); conn.Close();
//Response.Write(\添加成功');\ }
//添加综合总积分
string sqlstr1 = \stID,year,xueQi,(avgScore+cePing+jiaJiang+yanCheng) bb from jifen group by
stID,year,xueQi,avgScore,cePing,jiaJiang,yanCheng) a where jifen.stID=a.stID and jifen.year=a.year and
31
陈XX:三明学院班级电子信息档案管理系统设计与实现
jifen.xueQi=a.xueQi \;
SqlCommand cmd1 = new SqlCommand(sqlstr1, conn); conn.Open();
cmd1.ExecuteNonQuery(); conn.Close(); } }
32