




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、学 实 训 报 告 系部:信息技术系 课程名称:网站网页制作 专业班级:14计算机网络技术一班 姓名:xxx任课老师:xxx实验实训项目名称网站制作实验类型验证型实验室思科网络实验室实验时间实验方案设计(步骤)实验目的:1. 熟练掌握SQL语句的编写。2. 掌握使用VS2010对网页的设计。实验步骤:1. 登录页面主要代码:protectedvoid Button1_Click(object sender, EventArgs e) string username = TextBox1.Text;string password = TextBox2.Text;string connStr =
2、"server=(local);uid=sa;pwd=123456;database=StudentManager"SqlConnection conn = newSqlConnection(connStr);SqlCommand cmd = newSqlCommand("select * from UserInfo where username='" + username + "' and password='" + password + "'", conn); conn.Open
3、();SqlDataReader reader = cmd.ExecuteReader();/记?录?集if (reader.Read() Response.Redirect("main.aspx"); else Label1.Text = "用?户§名?或ò者?密ü码?错洙?误ó!?!?" conn.Close(); 2. 主页面+用户信息管理页面左侧主要运用了TreeView控件,然后用户信息运用了GridView控件,链接数据源,在页面中展示用户信息,主要代码:<asp:GridViewID="
4、;GridView1"runat="server"AllowPaging="True"AllowSorting="True"AutoGenerateColumns="False"DataKeyNames="Userid"DataSourceID="SqlDataSource1"style="font-family: 楷?体?; font-size: medium"Width="550px"BackColor="#DE
5、BA84"BorderColor="#DEBA84"BorderStyle="None"BorderWidth="1px"CellPadding="3"CellSpacing="2"><Columns><asp:BoundFieldDataField="Userid"HeaderText="序ò号?"ReadOnly="True"SortExpression="Userid"
6、;/><asp:BoundFieldDataField="UserName"HeaderText="用?户§名?"SortExpression="UserName"/><asp:BoundFieldDataField="Password"HeaderText="密ü码?"SortExpression="Password"/><asp:BoundFieldDataField="Email"HeaderT
7、ext="电?子哩?邮?件t"SortExpression="Email"/><asp:CommandFieldShowDeleteButton="True"ShowEditButton="True"/></Columns><FooterStyleBackColor="#F7DFB5"ForeColor="#8C4510"/><HeaderStyleBackColor="#A55129"Font-Bold=&
8、quot;True"ForeColor="White"/><PagerStyleForeColor="#8C4510"HorizontalAlign="Center"/><RowStyleBackColor="#FFF7E7"ForeColor="#8C4510"/><SelectedRowStyleBackColor="#738A9C"Font-Bold="True"ForeColor="White
9、"/><SortedAscendingCellStyleBackColor="#FFF1D4"/><SortedAscendingHeaderStyleBackColor="#B95C30"/><SortedDescendingCellStyleBackColor="#F1E5CE"/><SortedDescendingHeaderStyleBackColor="#93451F"/></asp:GridView><br/><
10、;asp:SqlDataSourceID="SqlDataSource1"runat="server"ConnectionString="<%$ ConnectionStrings:StudentManagerConnectionString %>"DeleteCommand="DELETE FROM UserInfo WHERE Userid = Userid"InsertCommand="INSERT INTO UserInfo (Userid, UserName, Password, E
11、mail) VALUES (Userid, UserName, Password, Email)"SelectCommand="SELECT * FROM UserInfo"UpdateCommand="UPDATE UserInfo SET UserName = UserName, Password = Password, Email = Email WHERE Userid = Userid">3. 学籍信息添加页面主要代码:protectedvoid Button1_Click(object sender, EventArgs e)
12、 string connStr = "server=(local);uid=sa;pwd=123456;database=StudentManager"SqlConnection conn = newSqlConnection(connStr);SqlCommand cmd = newSqlCommand("insert into StudentXj(Sno,Sname,Ssex,Sbrithday,DepartNo,ClassNo,Tel,Srxtime,xuezhi,xueli,address,youbian,zzmm,pingjia)values('
13、" + this.TextBox1.Text + "','" + this.TextBox2.Text + "','" + RadioButtonList1.Text + "','" + this.TextBox3.Text + "','" + this.TextBox12.Text + "','" + this.TextBox4.Text + "','" + this.
14、TextBox5.Text + "','" + this.TextBox6.Text + "','" + this.TextBox7.Text + "','" + this.TextBox8.Text + "','" + this.TextBox9.Text + "','" + this.TextBox10.Text + "','" + DropDownList1.Text + &
15、quot;','" + this.TextBox11.Text + "')", conn); conn.Open(); cmd.ExecuteNonQuery(); conn.Close(); 4. 学籍信息修改本页面也是用GridView控件,与数据库连接,展示出学籍信息,然后生成“修改”,单击“修改”方可进行修改,主要代码:<asp:GridViewID="GridView1"runat="server"AllowPaging="True"AllowSorting=&qu
16、ot;True"AutoGenerateColumns="False"BackColor="#DEBA84"BorderColor="#DEBA84"BorderStyle="None"BorderWidth="1px"CellPadding="3"CellSpacing="2"DataKeyNames="Sno"DataSourceID="SqlDataSource1"style="text-a
17、lign: center; font-family: 楷?体?; font-size: large; margin-top: 0px;"Width="1471px"><Columns><asp:BoundFieldDataField="Sno"HeaderText="Sno"ReadOnly="True"SortExpression="Sno"/><asp:BoundFieldDataField="Sname"HeaderText
18、="Sname"SortExpression="Sname"/><asp:BoundFieldDataField="Ssex"HeaderText="Ssex"SortExpression="Ssex"/><asp:BoundFieldDataField="Sbrithday"HeaderText="Sbrithday"SortExpression="Sbrithday"/><asp:BoundFie
19、ldDataField="DepartNo"HeaderText="DepartNo"SortExpression="DepartNo"/><asp:BoundFieldDataField="ClassNo"HeaderText="ClassNo"SortExpression="ClassNo"/><asp:BoundFieldDataField="Tel"HeaderText="Tel"SortExpressi
20、on="Tel"/><asp:BoundFieldDataField="Srxtime"HeaderText="Srxtime"SortExpression="Srxtime"/><asp:BoundFieldDataField="xuezhi"HeaderText="xuezhi"SortExpression="xuezhi"/><asp:BoundFieldDataField="xueli"Hea
21、derText="xueli"SortExpression="xueli"/><asp:BoundFieldDataField="address"HeaderText="address"SortExpression="address"/><asp:BoundFieldDataField="youbian"HeaderText="youbian"SortExpression="youbian"/><as
22、p:BoundFieldDataField="zzmm"HeaderText="zzmm"SortExpression="zzmm"/><asp:BoundFieldDataField="pingjia"HeaderText="pingjia"SortExpression="pingjia"/><asp:CommandFieldEditText="修T改?"ShowEditButton="True"/>&l
23、t;/Columns><FooterStyleBackColor="#F7DFB5"ForeColor="#8C4510"/><HeaderStyleBackColor="#A55129"Font-Bold="True"ForeColor="White"/><PagerStyleForeColor="#8C4510"HorizontalAlign="Center"/><RowStyleBackColor=&q
24、uot;#FFF7E7"ForeColor="#8C4510"/><SelectedRowStyleBackColor="#738A9C"Font-Bold="True"ForeColor="White"/><SortedAscendingCellStyleBackColor="#FFF1D4"/><SortedAscendingHeaderStyleBackColor="#B95C30"/><SortedDescen
25、dingCellStyleBackColor="#F1E5CE"/><SortedDescendingHeaderStyleBackColor="#93451F"/></asp:GridView><asp:SqlDataSourceID="SqlDataSource1"runat="server"ConnectionString="<%$ ConnectionStrings:StudentManagerConnectionString2 %>"De
26、leteCommand="DELETE FROM StudentXj 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, a
27、ddress, youbian, zzmm, pingjia)"SelectCommand="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, y
28、oubian = youbian, zzmm = zzmm, pingjia = pingjia WHERE Sno = Sno">5. 学籍信息查询 本页面运用GridView控件展示出学生信息,设置三种条件查询,按学号、姓名、系别方可查询出学生信息,主要代码:protectedvoid Page_Load(object sender, EventArgs e) string connStr = "server=(local);uid=sa;pwd=123456;database=StudentManager"SqlConnection conn = ne
29、wSqlConnection(connStr);SqlDataAdapter da = newSqlDataAdapter("select * from StudentXj", conn);DataSet ds = newDataSet(); da.Fill(ds); GridView1.DataSource = ds; GridView1.DataBind(); protectedvoid Button1_Click(object sender, EventArgs e) string connStr = "server=(local);uid=sa;pwd=1
30、23456;database=StudentManager"SqlConnection conn = newSqlConnection(connStr);SqlDataAdapter da = newSqlDataAdapter("select * from StudentXj where Sno='" + this.TextBox1.Text + "' or Sname='" + this.TextBox2.Text + "' or DepartNo='" + this.TextBo
31、x3.Text + "'", conn);DataSet ds = newDataSet(); da.Fill(ds); GridView1.DataSource = ds; GridView1.DataBind(); 6. 课程信息添加主要代码:protectedvoid Button1_Click(object sender, EventArgs e) string connStr = "server=(local);uid=sa;pwd=123456;database=StudentManager"SqlConnection conn =
32、newSqlConnection(connStr);SqlCommand cmd = newSqlCommand("insert into Course(Courseid,CourseName,Credit,Datetime)values('" + this.TextBox1.Text + "','" + this.TextBox2.Text + "','" + this.TextBox3.Text + "','" + this.TextBox4.Text +
33、 "')", conn); conn.Open(); cmd.ExecuteNonQuery(); conn.Close(); Label1.Text = "添?加ó成é功|!?!?!?" 7. 课程信息修改 本页面运用了GridView控件,并启用了“修改”,单击修改方可实现修改功能,主要代码:<asp:GridViewID="GridView1"runat="server"AutoGenerateColumns="False"BackColor="
34、#DEBA84"BorderColor="#DEBA84"BorderStyle="None"BorderWidth="1px"CellPadding="3"CellSpacing="2"DataKeyNames="Courseid"DataSourceID="SqlDataSource1"style="text-align: center; font-family: 楷?体?; font-size: large;"Width
35、="630px"><Columns><asp:BoundFieldDataField="Courseid"HeaderText="课?程ì编括?号?"ReadOnly="True"SortExpression="Courseid"/><asp:BoundFieldDataField="CourseName"HeaderText="课?程ì名?称?"SortExpression="Course
36、Name"/><asp:BoundFieldDataField="Credit"HeaderText="学§分?"SortExpression="Credit"/><asp:BoundFieldDataField="Datetime"HeaderText="日?期ú"SortExpression="Datetime"/><asp:CommandFieldEditText="修T改?"Head
37、erText="修T改?"ShowEditButton="True"/></Columns><FooterStyleBackColor="#F7DFB5"ForeColor="#8C4510"/><HeaderStyleBackColor="#A55129"Font-Bold="True"ForeColor="White"/><PagerStyleForeColor="#8C4510"Ho
38、rizontalAlign="Center"/><RowStyleBackColor="#FFF7E7"ForeColor="#8C4510"/><SelectedRowStyleBackColor="#738A9C"Font-Bold="True"ForeColor="White"/><SortedAscendingCellStyleBackColor="#FFF1D4"/><SortedAscending
39、HeaderStyleBackColor="#B95C30"/><SortedDescendingCellStyleBackColor="#F1E5CE"/><SortedDescendingHeaderStyleBackColor="#93451F"/></asp:GridView></center><asp:SqlDataSourceID="SqlDataSource1"runat="server"ConnectionString=
40、"<%$ ConnectionStrings:StudentManagerConnectionString4 %>"DeleteCommand="DELETE FROM Course WHERE Courseid = Courseid"InsertCommand="INSERT INTO Course (Courseid, CourseName, Credit, Datetime) VALUES (Courseid, CourseName, Credit, Datetime)"SelectCommand="SEL
41、ECT * FROM Course"UpdateCommand="UPDATE Course SET CourseName = CourseName, Credit = Credit, Datetime = Datetime WHERE Courseid = Courseid">8. 课程信息查询 添加了GridView控件,使它与数据源连接,查询课程信息分三个条件,按课程编号、课程名称、日期方可查询,主要代码:protectedvoid Page_Load(object sender, EventArgs e) string connStr = "
42、;server=(local);uid=sa;pwd=123456;database=StudentManager"SqlConnection conn = newSqlConnection(connStr);SqlDataAdapter da = newSqlDataAdapter("select * from Course", conn);DataSet ds = newDataSet(); da.Fill(ds); GridView1.DataSource = ds; GridView1.DataBind(); protectedvoid Button1_C
43、lick(object sender, EventArgs e) string connStr = "server=(local);uid=sa;pwd=123456;database=StudentManager"SqlConnection conn = newSqlConnection(connStr);SqlDataAdapter da = newSqlDataAdapter("select * from Course where Courseid='" + this.TextBox1.Text + "' or Cours
44、eName='" + this.TextBox2.Text + "' or Datetime='" + this.TextBox3.Text + "'", conn);DataSet ds = newDataSet(); da.Fill(ds); GridView1.DataSource = ds; GridView1.DataBind(); 9. 课程信息删除主要代码:<asp:GridViewID="GridView1"runat="server"AllowPag
45、ing="True"AutoGenerateColumns="False"BackColor="#DEBA84"BorderColor="#DEBA84"BorderStyle="None"BorderWidth="1px"CellPadding="3"CellSpacing="2"DataKeyNames="Courseid"DataSourceID="SqlDataSource1"style=
46、"text-align: center; font-family: 楷?体?; font-size: large;"><Columns><asp:BoundFieldDataField="Courseid"HeaderText="Courseid"ReadOnly="True"SortExpression="Courseid"/><asp:BoundFieldDataField="CourseName"HeaderText="Co
47、urseName"SortExpression="CourseName"/><asp:BoundFieldDataField="Credit"HeaderText="Credit"SortExpression="Credit"/><asp:BoundFieldDataField="Datetime"HeaderText="Datetime"SortExpression="Datetime"/><asp:Comm
48、andFieldShowDeleteButton="True"/></Columns><FooterStyleBackColor="#F7DFB5"ForeColor="#8C4510"/><HeaderStyleBackColor="#A55129"Font-Bold="True"ForeColor="White"/><PagerStyleForeColor="#8C4510"HorizontalAlign
49、="Center"/><RowStyleBackColor="#FFF7E7"ForeColor="#8C4510"/><SelectedRowStyleBackColor="#738A9C"Font-Bold="True"ForeColor="White"/><SortedAscendingCellStyleBackColor="#FFF1D4"/><SortedAscendingHeaderStyleBa
50、ckColor="#B95C30"/><SortedDescendingCellStyleBackColor="#F1E5CE"/><SortedDescendingHeaderStyleBackColor="#93451F"/></asp:GridView></center><asp:SqlDataSourceID="SqlDataSource1"runat="server"ConnectionString="<%$
51、ConnectionStrings:StudentManagerConnectionString3 %>"DeleteCommand="DELETE FROM Course WHERE Courseid = Courseid"InsertCommand="INSERT INTO Course (Courseid, CourseName, Credit, Datetime) VALUES (Courseid, CourseName, Credit, Datetime)"SelectCommand="SELECT * FROM Co
52、urse"UpdateCommand="UPDATE Course SET CourseName = CourseName, Credit = Credit, Datetime = Datetime WHERE Courseid = Courseid"><DeleteParameters><asp:ParameterName="Courseid"Type="Int32"/></DeleteParameters>10. 学生成绩添加主要代码:protectedvoid Button1_
53、Click(object sender, EventArgs e) string connStr = "server=(local);uid=sa;pwd=123456;database=StudentManager"SqlConnection conn = newSqlConnection(connStr);SqlCommand cmd = newSqlCommand("insert into StudentCJ(Sno,Sname,CourseName,Score)values('" + this.TextBox1.Text + "
54、','" + this.TextBox2.Text + "','" + this.TextBox3.Text + "','" + this.TextBox4.Text + "')", conn); conn.Open(); cmd.ExecuteNonQuery(); conn.Close(); Label1.Text = "添?加ó成é功|!?!?!?" 11. 学生成绩修改主要代码:<asp:GridViewID=&qu
55、ot;GridView1"runat="server"style="font-size: large; text-align: center;"AllowPaging="True"AutoGenerateColumns="False"BackColor="#DEBA84"BorderColor="#DEBA84"BorderStyle="None"BorderWidth="1px"CellPadding="3&quo
56、t;CellSpacing="2"DataKeyNames="Sno"DataSourceID="SqlDataSource1"Width="600px"><Columns><asp:BoundFieldDataField="Sno"HeaderText="Sno"ReadOnly="True"SortExpression="Sno"/><asp:BoundFieldDataField="S
57、name"HeaderText="Sname"SortExpression="Sname"/><asp:BoundFieldDataField="CourseName"HeaderText="CourseName"SortExpression="CourseName"/><asp:BoundFieldDataField="Score"HeaderText="Score"SortExpression="Score&
58、quot;/><asp:CommandFieldEditText="修T改?"ShowEditButton="True"/></Columns><FooterStyleBackColor="#F7DFB5"ForeColor="#8C4510"/><HeaderStyleBackColor="#A55129"Font-Bold="True"ForeColor="White"/><PagerStyl
59、eForeColor="#8C4510"HorizontalAlign="Center"/><RowStyleBackColor="#FFF7E7"ForeColor="#8C4510"/><SelectedRowStyleBackColor="#738A9C"Font-Bold="True"ForeColor="White"/><SortedAscendingCellStyleBackColor="#FFF1
60、D4"/><SortedAscendingHeaderStyleBackColor="#B95C30"/><SortedDescendingCellStyleBackColor="#F1E5CE"/><SortedDescendingHeaderStyleBackColor="#93451F"/></asp:GridView><asp:SqlDataSourceID="SqlDataSource1"runat="server"
61、ConnectionString="<%$ ConnectionStrings:StudentManagerConnectionString5 %>"DeleteCommand="DELETE FROM StudentCJ WHERE Sno = Sno"InsertCommand="INSERT INTO StudentCJ (Sno, Sname, CourseName, Score) VALUES (Sno, Sname, CourseName, Score)"SelectCommand="SELECT *
62、 FROM StudentCJ"UpdateCommand="UPDATE StudentCJ SET Sname = Sname, CourseName = CourseName, Score = Score WHERE Sno = Sno"><DeleteParameters><asp:ParameterName="Sno"Type="String"/></DeleteParameters>12. 学生成绩查询添加了GridView控件,使它与数据源连接,查询课程信息分三个条件,
63、按课程名称、学号、姓名方可查询,主要代码:protectedvoid Page_Load(object sender, EventArgs e) string connStr = "server=(local);uid=sa;pwd=123456;database=StudentManager"SqlConnection conn = newSqlConnection(connStr);SqlDataAdapter da = newSqlDataAdapter("select * from StudentCJ", conn);DataSet ds = n
64、ewDataSet(); da.Fill(ds); GridView1.DataSource = ds; GridView1.DataBind(); protectedvoid Button2_Click(object sender, EventArgs e) string connStr = "server=(local);uid=sa;pwd=123456;database=StudentManager"SqlConnection conn = newSqlConnection(connStr);SqlDataAdapter da = newSqlDataAdapter
65、("select * from StudentCJ where CourseName='" + this.TextBox1.Text + "' or Sno='" + this.TextBox2.Text + "' or Sname='" + this.TextBox3.Text + "'", conn);DataSet ds = newDataSet(); da.Fill(ds); GridView1.DataSource = ds; GridView1.DataBind(); 13. 学生成绩删除主要代码:<asp:GridViewID="GridView1"runat="server"AllowPaging="True"AutoGenerateColumns="False"BackColor="#DEBA84"BorderColor="#DEBA84"BorderStyle="None"BorderWidth="1px"CellPadding="3&q
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025-2030年中国陶瓷纤维市场竞争格局与前景发展策略分析报告
- 2025-2030年中国造纸机械市场运行态势及投资战略研究报告
- 2025-2030年中国蚝肉行业发展状况及营销战略研究报告
- 2025-2030年中国矿渣粉产业十三五规划及发展策略分析报告
- 2025-2030年中国电子铜箔市场运行状况及发展趋势预测报告
- 江西洪州职业学院《经济学的思维方式》2023-2024学年第二学期期末试卷
- 沈阳职业技术学院《受众与视听率分析》2023-2024学年第二学期期末试卷
- 益阳职业技术学院《公共关系》2023-2024学年第二学期期末试卷
- 2025届上海市松江区届高三上学期一模考试历史试卷
- 辽宁中医药大学杏林学院《软件测试技术实验》2023-2024学年第二学期期末试卷
- 工余安健环管理制度
- 某学校食堂服务投标书
- 空调维保服务项目质量保障措施
- 《马克思主义与社会科学方法论》课后思考题答案全
- 急性心肌梗塞
- 八年级地理下期教学计划(星球地图版)
- 休闲农业与乡村旅游(课件)
- 蓝色科技风半导体产业PPT模板
- 院感手卫生培训课件
- 铸牢中华民族共同体意识学习PPT
- 多重耐药鲍曼不动杆菌治疗课件
评论
0/150
提交评论