数据库原理及应用课程设计报告.doc_第1页
数据库原理及应用课程设计报告.doc_第2页
数据库原理及应用课程设计报告.doc_第3页
数据库原理及应用课程设计报告.doc_第4页
数据库原理及应用课程设计报告.doc_第5页
已阅读5页,还剩15页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

成绩数据库原理及应用课程设计报告商品销售管理系统学院:信息工程学院班级: 学号: 姓名: 完成时间: 201 课程设计的任务数据库原理及应用是计算机及其相关学科的一门重要的学科基础课程,也是计算机软件科学与技术、信息科学与技术的重要学科分支。本课程设计旨在通过对一个小型数据库管理系统(DBMS)的综合设计过程,强化学生对计算机系统软件的设计能力,提高学生的综合素质,并通过课程设计进一步加强学生对所学知识的理解,以及对数据库的全面、深刻认识。具体要求如下:1)了解DBMS的设计过程;2)掌握关系型DBMS的结构及实现;3)掌握系统程序设计的基础知识;4)深化理解并掌握数据库原理及应用课程的相关内容;5)强化软件开发的团队意识,提高合作能力。系统需求分析与设计数据流图ER图数据结构描述商品数据结构:ShanidChar6ShannameChar8ShancountSmailint2ShanpriceSmailint2Factoridchar6公司数据结构:FactoridChar6FactornamevarChar24FactoraddrvarChar24FactorphoneChar11销售数据结构:ShanidChar6FactoridChar6SalsecountSmailint2销售管理系统软件设计流程图和功能模块图商品信息查询商品信息录入销售信息查询销售信息录入公司信息查询公司信息录入程序模块汇总 商品信息录入; 商品信息查询; 公司信息录入; 公司信息查询; 销售信息录入; 销售信息查询;源程序清单主目录:using System;using System.Configuration;using System.Data;using System.Linq;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.HtmlControls;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Xml.Linq;public partial class _Default : System.Web.UI.Page protected void Page_Load(object sender, EventArgs e) protected void Button1_Click(object sender, EventArgs e) Response.Redirect(/Default2.aspx); protected void Button3_Click(object sender, EventArgs e) Response.Redirect(/Default3.aspx); protected void Button2_Click(object sender, EventArgs e) Response.Redirect(/Default4.aspx); protected void Button4_Click(object sender, EventArgs e) Response.Redirect(/Default6.aspx); protected void Button5_Click(object sender, EventArgs e) Response.Redirect(/Default4.aspx); protected void Button6_Click(object sender, EventArgs e) Response.Redirect(/Default5.aspx); protected void Button7_Click(object sender, EventArgs e) Response.Redirect(/Default7.aspx); 1 商品信息录入;using System;using System.Collections;using System.Configuration;using System.Data;using System.Linq;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.HtmlControls;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Xml.Linq;using System.Data.SqlClient;public partial class Default2 : System.Web.UI.Page protected void Page_Load(object sender, EventArgs e) protected void Button3_Click(object sender, EventArgs e) if (ShangID.Text.Trim().Length 1) Response.Write(window.alert(没有要删除的项!); return; SqlConnection con = new SqlConnection(server=localhost;user id=sa;pwd=123456;database=studb); con.Open(); string select = select count(*) as total from S where ShanID=+ ShangID.Text.Trim()+ ; SqlCommand cmdsel = new SqlCommand(select, con); SqlDataReader dr = cmdsel.ExecuteReader(); if (dr.Read() if (int.Parse(drtotal.ToString() = 0) Response.Write(window.alert(要删除的记录不存在!); return; dr.Close(); string str = delete from S where ShanID= + + ShangID.Text.Trim() + ; SqlCommand cmd = new SqlCommand(str, con); cmd.ExecuteNonQuery(); con.Close(); protected void Exit_Click(object sender, EventArgs e) Response.Redirect (/Default.aspx);protected void Insert_Click(object sender, EventArgs e) SqlConnection con = new SqlConnection(server=localhost;uid=sa;pwd=123456;database=studb); con.Open(); string insert = insert into S(ShanID,ShanName,ShanCount,ShanPrice,FactoryID) values( + + ShangID.Text.Trim() + + , + + ShangName.Text.Trim() + + , + ShangCount.Text.Trim() + , + + ShangPrice.Text.Trim() + + , + + ShangAddr.Text.Trim() + + ); Response.Write(insert); SqlCommand cmd1 = new SqlCommand(insert, con); cmd1.ExecuteNonQuery(); con.Close();2 商品信息查询;using System;using System.Collections;using System.Configuration;using System.Data;using System.Linq;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.HtmlControls;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Xml.Linq;using System.Data.SqlClient;public partial class Default3 : System.Web.UI.Page protected void Page_Load(object sender, EventArgs e) protected void MoveToFirst_Click(object sender, EventArgs e) SqlConnection con = new SqlConnection(server=localhost;user id=sa;pwd=123456;database=studb); con.Open(); string str = select ShanID from S order by ShanID asc; SqlCommand cmd = new SqlCommand(str, con); SqlDataReader sr = cmd.ExecuteReader(); if (sr.Read() string Student = srShanID.ToString(); Refresh(Student); sr.Close(); private void Refresh(string shangId) SqlConnection con = new SqlConnection(server=localhost;user id=sa;pwd=123456;database=studb); con.Open(); string str = select * from S where ShanID= + + shangId.ToString() + ; SqlCommand cmd = new SqlCommand(str, con); SqlDataReader sr = cmd.ExecuteReader(); if (sr.Read() ShangID.Text = shangId.ToString(); ShangName.Text = srShanName.ToString(); ShangCount.Text = srShanCount.ToString(); ShangPrice.Text = srShanPrice.ToString(); ShangAddr.Text = srFactoryID.ToString(); protected void MoveToPre_Click(object sender, EventArgs e) if (ShangID.Text.Trim().Length 1) Response.Write(window.alert(请选择一个当前项!); return; string shangid = ; SqlConnection con = new SqlConnection(server=localhost;user id=sa;pwd=123456;database=studb); con.Open(); string str = select ShanID from S order by ShanID asc; SqlCommand cmd = new SqlCommand(str, con); SqlDataReader sr = cmd.ExecuteReader(); if (sr.Read() shangid = srShanID.ToString(); sr.Close(); if (shangid = ShangID.Text.Trim() Response.Write(window.alert(当前数据项已经是第一个了!); return; else string tempstr = select max(ShanID) as maxid from S where ShanID + + ShangID.Text.Trim() + ; cmd.CommandText = tempstr; SqlDataReader dr = cmd.ExecuteReader(); if (dr.Read() string shId = drmaxid.ToString(); Refresh(shId); con.Close(); protected void MoveToNext_Click(object sender, EventArgs e) if (ShangID.Text.Trim().Length 1) Response.Write(window.alert(请选择一个当前项!); return; string shangid = ; SqlConnection con = new SqlConnection(server=localhost;user id=sa;pwd=123456;database=studb); con.Open(); string str = select ShanID from S order by ShanID desc; SqlCommand cmd = new SqlCommand(str, con); SqlDataReader sr = cmd.ExecuteReader(); if (sr.Read() shangid = srShanID.ToString(); sr.Close(); if (shangid = ShangID.Text.Trim() Response.Write(window.alert(当前数据项已经是最后一个了!); return; else string tempstr = select min(ShanID) as maxid from S where ShanID + + ShangID.Text.Trim() + ; cmd.CommandText = tempstr; SqlDataReader dr = cmd.ExecuteReader(); if (dr.Read() string shId = drmaxid.ToString(); Refresh(shId); con.Close(); protected void MoveToLast_Click(object sender, EventArgs e) SqlConnection con = new SqlConnection(server=localhost;user id=sa;pwd=123456;database=studb); con.Open(); string str = select ShanID from S order by ShanID desc; SqlCommand cmd = new SqlCommand(str, con); SqlDataReader sr = cmd.ExecuteReader(); if (sr.Read() string Shang = srShanID.ToString(); Refresh(Shang); sr.Close(); con.Close(); protected void KeySelect_Click(object sender, EventArgs e) bool find = false; SqlConnection con = new SqlConnection(server=localhost;user id=sa;pwd=123456;database=studb); con.Open(); string cmdstr = select * from S; SqlDataAdapter da = new SqlDataAdapter(cmdstr, con); DataSet ds = new DataSet(); da.Fill(ds); for (int i = 0; i ds.Tables0.Rows.Count; i+) for (int j = 0; j ds.Tables0.Columns.Count; j+) string data = (ds.Tables0.Rowsij.ToString().Trim(); if (data = Select.Text.Trim() ShangID.Text = ds.Tables0.RowsiShanID.ToString(); ShangName.Text = ds.Tables0.RowsiShanName.ToString(); ShangCount.Text = ds.Tables0.RowsiShanCount.ToString(); ShangPrice.Text = ds.Tables0.RowsiShanPrice.ToString(); ShangAddr.Text = ds.Tables0.RowsiFactoryID.ToString(); find = true; if (find = false) Response.Write(window.alert(没有相关记录!); con.Close(); protected void Exit_Click(object sender, EventArgs e) Response.Redirect(/Default.aspx); 3 公司信息录入;using System;using System.Collections;using System.Configuration;using System.Data;using System.Linq;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.HtmlControls;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Xml.Linq;using System.Data.SqlClient;public partial class Default4 : System.Web.UI.Page protected void Page_Load(object sender, EventArgs e) protected void Insert_Click(object sender, EventArgs e) SqlConnection con = new SqlConnection(server=localhost;uid=sa;pwd=123456;database=studb); con.Open(); string insert = insert into Factory(FactorID,FactorName,FactorAddr,FactorPhone) values( + + FactoryID.Text.Trim() + + , + + FactoryName.Text.Trim() + + , + + FactoryAddr.Text.Trim() + + , + + FactoryPhone.Text.Trim() + + ); Response.Write(insert); SqlCommand cmd1 = new SqlCommand(insert, con); cmd1.ExecuteNonQuery(); con.Close(); protected void Delete_Click(object sender, EventArgs e) if (FactoryID.Text.Trim().Length 1) Response.Write(window.alert(没有要删除的项!); return; SqlConnection con = new SqlConnection(server=localhost;user id=sa;pwd=123456;database=studb); con.Open(); string select = select count(*) as total from Factory where FactorID= + + FactoryID.Text.Trim() + ; SqlCommand cmdsel = new SqlCommand(select, con); SqlDataReader dr = cmdsel.ExecuteReader(); if (dr.Read() if (int.Parse(drtotal.ToString() = 0) Response.Write(window.alert(要删除的记录不存在!); return; dr.Close(); string str = delete from Factory where FactorID= + + FactoryID.Text.Trim() + ; SqlCommand cmd = new SqlCommand(str, con); cmd.ExecuteNonQuery(); con.Close(); protected void Exit_Click(object sender, EventArgs e) Response.Redirect(/Default.aspx); 4 公司信息查询;using System;using System.Collections;using System.Configuration;using System.Data;using System.Linq;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.HtmlControls;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Xml.Linq;using System.Data.SqlClient;public partial class Default5 : System.Web.UI.Page protected void Page_Load(object sender, EventArgs e) protected void MoveToFirst_Click(object sender, EventArgs e) SqlConnection con = new SqlConnection(server=localhost;user id=sa;pwd=123456;database=studb); con.Open(); string str = select FactorID from Factory order by FactorID asc; SqlCommand cmd = new SqlCommand(str, con); SqlDataReader sr = cmd.ExecuteReader(); if (sr.Read() string Student = srFactorID.ToString(); Refresh(Student); sr.Close(); private void Refresh(string factorId) SqlConnection con = new SqlConnection(server=localhost;user id=sa;pwd=123456;database=studb); con.Open(); string str = select * from Factory where FactorID= + + factorId.ToString() + ; SqlCommand cmd = new SqlCommand(str, con); SqlDataReader sr = cmd.ExecuteReader(); if (sr.Read() FactoryID.Text = factorId.ToString(); FactoryName.Text = srFactorName.ToString(); FactoryAddr.Text = srFactorAddr.ToString(); FactoryPhone.Text = srFactorPhone.ToString(); protected void MoveToPre_Click(object sender, EventArgs e) if (FactoryID.Text.Trim().Length 1) Response.Write(window.alert(请选择一个当前项!); return; string factoryid = ; SqlConnection con = new SqlConnection(server=localhost;user id=sa;pwd=123456;database=studb); con.Open(); string str = select FactorID from Factory order by FactorID asc; SqlCommand cmd = new SqlCommand(str, con); SqlDataReader sr = cmd.ExecuteReader(); if (sr.Read() factoryid = srFactorID.ToString(); sr.Close(); if (factoryid = FactoryID.Text.Trim() Response.Write(window.alert(当前数据项已经是第一个了!); return; else string tempstr = select max(FactorID) as maxid from Factory where FactorID + + FactoryID.Text.Trim() + ; cmd.CommandText = tempstr; SqlDataReader dr = cmd.ExecuteReader(); if (dr.Read() string faId = drmaxid.ToString(); Refresh(faId); con.Close(); protected void MoveToNext_Click(object sender, EventArgs e) if (FactoryID.Text.Trim().Length 1) Response.Write(window.alert(请选择一个当前项!); return; string factoryid = ; SqlConnection con = new SqlConnection(server=localhost;user id=sa;pwd=123456;database=studb); con.Open(); string str = select FactorID from Factory order by FactorID desc; SqlCommand cmd = new SqlCommand(str, con); SqlDataReader sr = cmd.ExecuteReader(); if (sr.Read() factoryid = srFactorID.ToString(); sr.Close(); if (factoryid = FactoryID.Text.Trim() Response.Write(window.alert(当前数据项已经是最后一个了!); return; else string tempstr = select min(FactorID) as maxid from Factory where FactorID + + FactoryID.Text.Trim() + ; cmd.CommandText = tempstr; SqlDataReader dr = cmd.ExecuteReader(); if (dr.Read() string faId = drmaxid.ToString(); Refresh(faId); con.Close(); protected void MoveToLast_Click(object sender, EventArgs e) SqlConnection con = new SqlConnection(server=localhost;user id=sa;pwd=123456;database=studb); con.Open(); string str = select FactorID from Factory order by FactorID desc; SqlCommand cmd = new SqlCommand(str, con); SqlDataReader sr = cmd.ExecuteReader(); if (sr.Read() string Factory = srFactorID.ToString(); Refresh(Factory); sr.Close(); con.Close(); protected void Selecte_Click(object sender, EventArgs e) bool find = false; SqlConnectio

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论