资源预览内容
第1页 / 共20页
第2页 / 共20页
第3页 / 共20页
第4页 / 共20页
第5页 / 共20页
第6页 / 共20页
第7页 / 共20页
第8页 / 共20页
第9页 / 共20页
第10页 / 共20页
亲,该文档总共20页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述
河南机电高等专科学校学生课程设计报告实验课程名称 c#程序设计及应用教程 开课实验室 实字3号楼 301 系、部 计科系 年级 11 专业班 软件111(对口 学 生 姓 名 胡玉祥 学 号 开 课 时 间 2012 至 2013 学年第 一 学期总 成 绩教师签名C#程序设计课程设计报告 2013年 1 月 15日系部计科系年级、专业、班软件111姓名 课程名称C#程序设计项目名称超市管理系统指导教师 教师评语教师签名:年 月 日一、 课程设计目的经过一学期对c#开发语言的学习,利用本学期所学的知识进行一次简单的检测,因此做了本系统。二、实验环境装有Visual studio 2010 和sql数据库的计算机一台。三、实验过程及内容1、课题分析及要求:利用C#编程语言,结合数据库完成本系统开发。需包含模块:进货登记、销售记录管理、库存管理、商品查询、人员管理。2、程序分析:本系统根据要求可分为:登录模块,管理员模块和普通用户模块,其中,管理员模块中又可分为:进货登记、销售记录管理、库存管理、商品查询、人员管理。3、程序流程图(如上图所示)4、程序代码:连接数据库的类Sjk的代码using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Data.SqlClient;using System.Data;namespace chaoshiguanlixitong class Sjk public string s = ; public SqlConnection conn = new SqlConnection(Data Source=(local);Initial Catalog=csgl; Integrated Security=SSPI); public string cx(string sql) DataTable dt = new DataTable(); using (SqlDataAdapter adapter = new SqlDataAdapter(sql, conn) s = ; try adapter.Fill(dt); foreach (DataRow dr in dt.Rows) s = dr0.ToString(); catch (Exception ex) s = ex.ToString(); return s; public string cx(string sql, int i) s = ; DataTable dt = new DataTable(); using (SqlDataAdapter adapter = new SqlDataAdapter(sql, conn) try adapter.Fill(dt); foreach (DataRow dr in dt.Rows) for (int k = 0; k i; k+) s += drk.ToString() + ,; catch (Exception ex) s = ex.ToString(); return s; public string tj(string sql) s = ; SqlCommand myupdater = new SqlCommand(sql, conn); try conn.Open(); myupdater.ExecuteNonQuery(); conn.Close(); catch (Exception ex) s = ex.ToString (); conn.Close(); return s; public int qh(string sql) int i = 0; DataTable dt1 = new DataTable(); using (SqlDataAdapter adapter = new SqlDataAdapter(sql, conn) try adapter.Fill(dt1); foreach (DataRow dr1 in dt1.Rows) i += int.Parse(dr10.ToString(); finally return i; public int xg(string sql) int i=-1; using (SqlCommand cmd = new SqlCommand(sql, conn) try conn.Open(); i = cmd.ExecuteNonQuery(); conn.Close(); catch (Exception ) conn.Close(); return i; 登录窗体Form1的代码:using System;using System.Collections.Generic;using System.ComponentModel;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;namespace chaoshiguanlixitong public partial class Form1 : Form public static string yhm; public Form1() InitializeComponent(); private void button1_Click(object sender, EventArgs e) if (textBox1.Text = | textBox2.Text = ) label3.Text = 账号或密码不能为空!; else string m = select 密码 from denglu where 账号= + textBox1.Text + ; string g = select 管理员 from denglu where 账号= + textBox1.Text + ; Sjk d = new Sjk(); if (d.cx(m).Trim() = textBox2.Text) yhm = textBox1.Text; if (d.cx(g).Trim() = t) Form2 f2 = new Form2(); f2.Show(); else Form3 f3 = new Form3(); f3.
收藏 下载该资源
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号