《学生管理系统(界面+源代码)(共16页).doc》由会员分享,可在线阅读,更多相关《学生管理系统(界面+源代码)(共16页).doc(16页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。
1、精选优质文档-倾情为你奉上内蒙古信息工程系学 实 训 报 告 系部:信息技术系 课程名称:网站网页制作 专业班级:14计算机网络技术一班 姓名:xxx 任课老师:xxx实验实训项目名称网站制作实验类型验证型实验室思科网络实验室实验时间实验方案设计(步骤)实验目的:1. 熟练掌握SQL语句的编写。2. 掌握使用VS2010对网页的设计。实验步骤:1. 登录页面主要代码:protected void Button1_Click(object sender, EventArgs e) string username = TextBox1.Text; string password = TextBox
2、2.Text; string connStr = server=(local);uid=sa;pwd=;database=StudentManager; SqlConnection conn = new SqlConnection(connStr); SqlCommand cmd = new SqlCommand(select * from UserInfo where username= + username + and password= + password + , conn); conn.Open(); SqlDataReader reader = cmd.ExecuteReader(
3、);/记?录?集 if (reader.Read() Response.Redirect(main.aspx); else Label1.Text = 用?户名?或者?密码?错洙?误!?!?; conn.Close(); 2. 主页面+用户信息管理页面左侧主要运用了TreeView控件,然后用户信息运用了GridView控件,链接数据源,在页面中展示用户信息,主要代码: asp:SqlDataSource ID=SqlDataSource1 runat=server ConnectionString= DeleteCommand=DELETE FROM UserInfo WHERE Useri
4、d = Userid InsertCommand=INSERT INTO UserInfo (Userid, UserName, Password, Email) VALUES (Userid, UserName, Password, Email) SelectCommand=SELECT * FROM UserInfo UpdateCommand=UPDATE UserInfo SET UserName = UserName, Password = Password, Email = Email WHERE Userid = Userid3. 学籍信息添加页面主要代码:protected v
5、oid Button1_Click(object sender, EventArgs e) string connStr = server=(local);uid=sa;pwd=;database=StudentManager; SqlConnection conn = new SqlConnection(connStr); SqlCommand cmd = new SqlCommand(insert into StudentXj(Sno,Sname,Ssex,Sbrithday,DepartNo,ClassNo,Tel,Srxtime,xuezhi,xueli,address,youbian
6、,zzmm,pingjia)values( + this.TextBox1.Text + , + this.TextBox2.Text + , + RadioButtonList1.Text + , + this.TextBox3.Text + , + this.TextBox12.Text + , + this.TextBox4.Text + , + this.TextBox5.Text + , + this.TextBox6.Text + , + this.TextBox7.Text + , + this.TextBox8.Text + , + this.TextBox9.Text + ,
7、 + this.TextBox10.Text + , + DropDownList1.Text + , + this.TextBox11.Text + ), conn); conn.Open(); cmd.ExecuteNonQuery(); conn.Close(); 4. 学籍信息修改本页面也是用GridView控件,与数据库连接,展示出学籍信息,然后生成“修改”,单击“修改”方可进行修改,主要代码: asp:SqlDataSource ID=SqlDataSource1 runat=server ConnectionString= DeleteCommand=DELETE FROM St
8、udentXj WHERE Sno = Sno InsertCommand=INSERT INTO StudentXj (Sno, Sname, Ssex, Sbrithday, DepartNo, ClassNo, Tel, Srxtime, xuezhi, xueli, address, youbian, zzmm, pingjia) VALUES (Sno, Sname, Ssex, Sbrithday, DepartNo, ClassNo, Tel, Srxtime, xuezhi, xueli, address, youbian, zzmm, pingjia) SelectComma
9、nd=SELECT * FROM StudentXj UpdateCommand=UPDATE StudentXj SET Sname = Sname, Ssex = Ssex, Sbrithday = Sbrithday, DepartNo = DepartNo, ClassNo = ClassNo, Tel = Tel, Srxtime = Srxtime, xuezhi = xuezhi, xueli = xueli, address = address, youbian = youbian, zzmm = zzmm, pingjia = pingjia WHERE Sno = Sno5
10、. 学籍信息查询 本页面运用GridView控件展示出学生信息,设置三种条件查询,按学号、姓名、系别方可查询出学生信息,主要代码:protected void Page_Load(object sender, EventArgs e) string connStr = server=(local);uid=sa;pwd=;database=StudentManager; SqlConnection conn = new SqlConnection(connStr); SqlDataAdapter da = new SqlDataAdapter(select * from StudentXj,
11、conn); DataSet ds = new DataSet(); da.Fill(ds); GridView1.DataSource = ds; GridView1.DataBind(); protected void Button1_Click(object sender, EventArgs e) string connStr = server=(local);uid=sa;pwd=;database=StudentManager; SqlConnection conn = new SqlConnection(connStr); SqlDataAdapter da = new SqlD
12、ataAdapter(select * from StudentXj where Sno= + this.TextBox1.Text + or Sname= + this.TextBox2.Text + or DepartNo= + this.TextBox3.Text + , conn); DataSet ds = new DataSet(); da.Fill(ds); GridView1.DataSource = ds; GridView1.DataBind(); 6. 课程信息添加主要代码: protected void Button1_Click(object sender, Even
13、tArgs e) string connStr = server=(local);uid=sa;pwd=;database=StudentManager; SqlConnection conn = new SqlConnection(connStr); SqlCommand cmd = new SqlCommand(insert into Course(Courseid,CourseName,Credit,Datetime)values( + this.TextBox1.Text + , + this.TextBox2.Text + , + this.TextBox3.Text + , + t
14、his.TextBox4.Text + ), conn); conn.Open(); cmd.ExecuteNonQuery(); conn.Close(); Label1.Text = 添?加成功|!?!?!?; 7. 课程信息修改 本页面运用了GridView控件,并启用了“修改”,单击修改方可实现修改功能,主要代码: asp:SqlDataSource ID=SqlDataSource1 runat=server ConnectionString= DeleteCommand=DELETE FROM Course WHERE Courseid = Courseid InsertComma
15、nd=INSERT INTO Course (Courseid, CourseName, Credit, Datetime) VALUES (Courseid, CourseName, Credit, Datetime) SelectCommand=SELECT * FROM Course UpdateCommand=UPDATE Course SET CourseName = CourseName, Credit = Credit, Datetime = Datetime WHERE Courseid = Courseid8. 课程信息查询 添加了GridView控件,使它与数据源连接,查询
16、课程信息分三个条件,按课程编号、课程名称、日期方可查询,主要代码:protected void Page_Load(object sender, EventArgs e) string connStr = server=(local);uid=sa;pwd=;database=StudentManager; SqlConnection conn = new SqlConnection(connStr); SqlDataAdapter da = new SqlDataAdapter(select * from Course, conn); DataSet ds = new DataSet();
17、da.Fill(ds); GridView1.DataSource = ds; GridView1.DataBind(); protected void Button1_Click(object sender, EventArgs e) string connStr = server=(local);uid=sa;pwd=;database=StudentManager; SqlConnection conn = new SqlConnection(connStr); SqlDataAdapter da = new SqlDataAdapter(select * from Course where Courseid= + this.TextBox1.Text + or CourseName= + this.TextBox2.Text + or Datetime= + this.TextBox3.Text + , conn); DataSet ds = new DataSet(); da.Fill(ds); GridView1.DataSource = ds; GridView1.DataBind(); 9. 课程信息删除 主要代码: SortedAscendingCellS