欢迎来到天天文库
浏览记录
ID:39701642
大小:286.00 KB
页数:20页
时间:2019-07-09
《C#程序超市管理系统资料》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库。
1、河南机电高等专科学校学生课程设计报告实验课程名称c#程序设计及应用教程开课实验室实字3号楼301系、部计科系年级11专业班软件111(对口学生姓名胡玉祥学号开课时间2012至2013学年第一学期总成绩教师签名《C#程序设计》课程设计报告2013年1月15日系部计科系年级、专业、班软件111姓名课程名称C#程序设计项目名称超市管理系统指导教师教师评语教师签名:年月日一、课程设计目的经过一学期对c#开发语言的学习,利用本学期所学的知识进行一次简单的检测,因此做了本系统。二、实验环境装有Visualstudio2010和sql数据库的计算机一台。三、实
2、验过程及内容1、课题分析及要求:利用C#编程语言,结合数据库完成本系统开发。需包含模块:进货登记、销售记录管理、库存管理、商品查询、人员管理。2、程序分析:本系统根据要求可分为:登录模块,管理员模块和普通用户模块,其中,管理员模块中又可分为:进货登记、销售记录管理、库存管理、商品查询、人员管理。3、程序流程图(如上图所示)4、程序代码:连接数据库的类Sjk的代码usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;usingSystem.Data
3、.SqlClient;usingSystem.Data;namespacechaoshiguanlixitong{classSjk{publicstrings="";publicSqlConnectionconn=newSqlConnection("DataSource=(local);InitialCatalog=csgl;IntegratedSecurity=SSPI");publicstringcx(stringsql){DataTabledt=newDataTable();using(SqlDataAdapteradapter=newSq
4、lDataAdapter(sql,conn)){s="";try{adapter.Fill(dt);foreach(DataRowdrindt.Rows){s=dr[0].ToString();}}catch(Exceptionex){s=ex.ToString();}returns;}}publicstringcx(stringsql,inti){s="";DataTabledt=newDataTable();using(SqlDataAdapteradapter=newSqlDataAdapter(sql,conn)){try{adapter
5、.Fill(dt);foreach(DataRowdrindt.Rows){for(intk=0;k
6、nex){s=ex.ToString();conn.Close();}returns;}publicintqh(stringsql){inti=0;DataTabledt1=newDataTable();using(SqlDataAdapteradapter=newSqlDataAdapter(sql,conn)){try{adapter.Fill(dt1);foreach(DataRowdr1indt1.Rows){i+=int.Parse(dr1[0].ToString());}}finally{}}returni;}publicintxg(
7、stringsql){inti=-1;using(SqlCommandcmd=newSqlCommand(sql,conn)){try{conn.Open();i=cmd.ExecuteNonQuery();conn.Close();}catch(Exception){conn.Close();}}returni;}}}登录窗体Form1的代码:usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Drawing;usingSystem
8、.Linq;usingSystem.Text;usingSystem.Windows.Forms;namespacechaoshigua
此文档下载收益归作者所有