已阅读5页,还剩27页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
精品文档.Net体系及编程大作业网上商城姓名:张通学号:2220143682一、实验目的实现一个网上商城。管理员将货物信息整理归类发布到网上,用户登录该网站后,首先要注册为会员才能购买图书。该系统的使用者主要分为2类:注册用户和管理员。注册用户除了可以浏览网上商城中的货物信息外,还可以进行网上购物;管理员可以对网上商城中的商品信息进行管理、对客户订单进行处理等。主要包括以下功能模块:前台:(1)用户注册登录;(2)货物查询;(3)货物订购;(4)订单查询;(5)用户信息修改;后台:(1)货物管理;(2)订单管理;(3)用户管理;二、实验数据库三、实验代码Default.aspx Login.aspx 会员姓名: 会员密码: 验 证 码: Login.aspx.csusing System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;using System.Data;using System.Data.SqlClient; public partial class login : System.Web.UI.Page protected void Page_Load(object sender, EventArgs e) SqlConnection Conn; Conn = new SqlConnection(Data Source=pc-1230;Initial Catalog=user;Integrated Security=True); /Windows身份验证 if (!IsPostBack) Random randobj = new Random(); labCode.Text = randobj.Next(1000, 10000).ToString();/返回一个指定范围内的随机数(int) protected void btnLogin_Click(object sender, EventArgs e) SqlConnection sqlconn; sqlconn = new SqlConnection(Data Source=pc-1230;Initial Catalog=user;Integrated Security=True); sqlconn.Open(); string sql = select * from member1 where id = id and pwd = pwd; SqlCommand Comm = new SqlCommand(sql, sqlconn); Comm.Parameters.Add(id, txtMName.Text); Comm.Parameters.Add(pwd, txtMPwd.Text); SqlDataReader sdr = Comm.ExecuteReader(); if (txtMCode.Text.Trim() = labCode.Text.Trim() if (sdr.Read() Sessionid = txtMName.Text; if (Sessionid.ToString() != admin) Response.Redirect(SuccReg.aspx); else Response.Redirect(admin.aspx); else Response.Write(alert(您输入的用户名或密码错误,请重新输入!);location=javascript:history.go(-1);); else Response.Write(alert(验证码输入有误,请重新输入!);location=javascript:history.go(-1);); sqlconn.Close(); protected void btnCancle_Click(object sender, EventArgs e) Response.Write(window.close();location=javascript:history.go(-1);); Logon.aspx 用户名 密码 确认密码 生日 电话号码 邮箱 Logon.aspx.csusing System;using System.Data;using System.Data.SqlClient;using System.Configuration;using System.Collections;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Web.UI.HtmlControls;public partial class logon : System.Web.UI.Page protected void Page_Load(object sender, EventArgs e) protected void Button2_Click(object sender, EventArgs e) SqlConnection sqlconn; sqlconn = new SqlConnection(Data Source=pc-1230;Initial Catalog=user;Integrated Security=True); string sqlstr = select * from member1 where id= + this.TextBox1.Text + ; sqlconn.Open(); SqlCommand sqlcom = new SqlCommand(sqlstr, sqlconn); SqlDataReader read = sqlcom.ExecuteReader(); read.Read(); if (read.HasRows) if (this.TextBox1.Text.Trim() = readid.ToString().Trim() Response.Write(alert(该会员已经注册过);localtion=Register.aspx); return; else Response.Write(alert(您可以进行正常注册);localtion=Register.aspx); read.Close(); sqlconn.Close(); protected void Button1_Click(object sender, EventArgs e) SqlConnection sqlconn; sqlconn = new SqlConnection(Data Source=pc-1230;Initial Catalog=user;Integrated Security=True); sqlconn.Open(); string sqlstr = insert into member1 + (id,pwd,birth,phone,email) + values( + TextBox1.Text + , + TextBox2.Text + , + TextBox4.Text + , + TextBox5.Text + , + TextBox6.Text + ); SqlCommand Comm = new SqlCommand(sqlstr, sqlconn); Comm.ExecuteNonQuery(); sqlconn.Close(); Sessionid = TextBox1.Text.Trim(); Response.Redirect(SuccReg.aspx); Car.aspx asp:SqlDataSource ID=SqlDataSource2 runat=server ConnectionString= DeleteCommand=DELETE FROM car1 WHERE id = id AND goodsid = goodsid InsertCommand=INSERT INTO car1 (id, goodsid, goodsname, num) VALUES (id, goodsid, goodsname, num) SelectCommand=SELECT * FROM car1 WHERE (id = id) UpdateCommand=UPDATE car1 SET goodsname = goodsname, num = num WHERE id = id AND goodsid = goodsid Admin.aspx asp:SqlDataSource ID=SqlDataSource1 runat=server ConnectionString= DeleteCommand=DELETE FROM goodsinfo WHERE goodsid = goodsid InsertCommand=INSERT INTO goodsinfo (goodsname, goodsid, goodsnum, goodsphoto) VALUES (goodsname, goodsid, goodsnum, goodsphoto) SelectCommand=SELECT * FROM goodsinfo UpdateCommand=UPDATE goodsinfo SET goodsname = goodsname, goodsnum = goodsnum, goodsphoto = goodsphoto WHERE goodsid = goodsid asp:SqlDataSource ID=SqlDataSource2 runat=server ConnectionString= DeleteCommand=DELETE FROM car1 WHERE id = id AND go
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 【安全考试】危化品生产安全管理员2【30套题(有答案)】
- 2025年聊城辅警招聘考试题库含答案详解(b卷)
- 2025中文版销售合同模板
- 2025年省直辖行政单位辅警协警招聘考试备考题库及完整答案详解一套
- 2025年萍乡辅警招聘考试题库含答案详解(轻巧夺冠)
- 2025年深圳辅警招聘考试真题及答案详解参考
- 2025年随州辅警协警招聘考试真题附答案详解(综合卷)
- 2025年韶关辅警协警招聘考试真题附答案详解(满分必刷)
- 2025年湛江辅警协警招聘考试备考题库含答案详解(预热题)
- 2025年鸡西辅警招聘考试真题附答案详解ab卷
- 工会购买服务管理办法
- 常见危急值及护理要点
- DB32T5119-2025《锂离子电池工厂生产安全技术规范》
- 中储粮(宁德)直属库有限公司仓储一期项目可行性研究报告
- 多普勒效应讲课件
- 诊所燃气安全管理制度
- 2025-2030中国小型发电机行业运营状况及应用趋势预测报告
- 普通货运企业安全生产管理制度
- 原发性醛固酮增多症
- 出口包装合同范本10篇
- 新疆开放大学2025年春《国家安全教育》形考作业1-4终考作业答案
评论
0/150
提交评论