课程设计实验报告.doc_第1页
课程设计实验报告.doc_第2页
课程设计实验报告.doc_第3页
课程设计实验报告.doc_第4页
课程设计实验报告.doc_第5页
已阅读5页,还剩18页未读 继续免费阅读

下载本文档

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

文档简介

武汉工业学院 数据库系统课 程 设 计 说 明 书设计题目:图书管理系统姓 名_ _学 院 数学与计算机学院专 业 信息管理 学 号 指导教师 2012 年 6 月 22 日1、 设计题目图书管理系统2、 设计目的数据库系统课程设计是计算机类专业的集中实践性环节之一,是学习完数据库系统概论课程后进行的一次全面的综合练习。其目的在于加深对大型数据库基础理论和基本知识的理解,掌握使用数据库设计与使用的基本方法,提高运用数据库解决实际问题的能力。3、 设计任务每班以四至五人为一组,采用自由分组、推选组长的形式,由班级学习委员将分组情况报到指导教师处,各小组的选题由指导教师指定。4、 设计内容使用SQLServer作为后台数据库,选择ASP或VB等作为前台开发工具设计一个小型管理系统。所设计的小型管理系统应包含输入输出、查询、插入、删除等基本功能。根据题目的基本需求,设计数据库,编写程序,并写出详细的设计说明书。完成图书资料的管理,处理的信息包括图书信息、读者信息、出版社、图书分类、图书借阅等5、 源代码using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using System.Data.SqlClient;namespace 图书管理系统 public partial class Form1 : Form / public string user; public Form1() InitializeComponent(); private void button2_Click(object sender, EventArgs e) MessageBox.Show(请查找出正确的用户名和密码); private void button1_Click(object sender, EventArgs e) string 用户名 = textBox1.Text; string 密码 = textBox2.Text; string 权限= 0; if (radioButton1.Checked = true) 权限= 1; else if (radioButton2.Checked = true) 权限= 0; string consqlserver = Data source=localhost;Initial Catalog=图书管理系统;Integrated Security=True; SqlConnection con = new SqlConnection(consqlserver); string sql = string.Format(select count(*) from权限设置 where 用户名=0and 密码=1and 权限=2, 用户名,密码,权限); try con.Open(); SqlCommand command = new SqlCommand(sql, con); int num = (int)command.ExecuteScalar(); if (radioButton1.Checked = true) if (num 0) MessageBox.Show(欢迎进入图书管理系统); 学生页面 xuesheng = new 学生页面(); /学生页面 user = new 学生页面(); xuesheng.user = textBox1.Text; / xuesheng.user= textBox1.Text; xuesheng.Show(); this.Visible = false; else MessageBox.Show(输入的用户名或者密码错误,请重新检查后再登录); else if (num 0) MessageBox.Show(欢迎进入图书管理系统); 管理员页面? guanliyuan = new 管理员页面(); / guanliyuan.user = textBox1.Text; guanliyuan.Show(); this.Visible = false; else MessageBox.Show(输入的密码或用户名错误,请检查后再登录); catch (Exception ex) MessageBox.Show(ex.Message); finally con.Close(); private void Form1_Load(object sender, EventArgs e) private void label1_Click(object sender, EventArgs e) public partial class 学生个人信息表: Form public string user1; public 学生个人信息表) InitializeComponent(); string str1 = Data Source=localhost;Initial Catalog=图书管理系统;Integrated Security=True; SqlConnection mycon; SqlDataAdapter myda; DataSet myds; int counts = 0; int MaxValue; private void showdata() textBox1.Text = user1; string strSql = Select 学号, 姓名,性别,院系,班级 from 学生表; mycon = new SqlConnection(str1); myda = new SqlDataAdapter(strSql, mycon); myds = new DataSet(); myda.Fill(myds); /dataGridView1.DataSource = myds.Tables0; private void showInfo(int sta) textBox1.Text = user1; myda = new SqlDataAdapter(select * from 学生表where 学号=+textBox1.Text , mycon); myds = new DataSet(); myda.Fill(myds); textBox2.Text = myds.Tables0.Rowssta1.ToString(); textBox3.Text = myds.Tables0.Rowssta2.ToString(); textBox4.Text = myds.Tables0.Rowssta3.ToString(); textBox5.Text = myds.Tables0.Rowssta4.ToString(); private void 学生个人信息表Load(object sender, EventArgs e) showdata(); showInfo(0); mycon = new SqlConnection(str1); mycon.Open(); SqlCommand command = new SqlCommand(select Count(*) from 学生表, mycon); MaxValue = Convert.ToInt32(command.ExecuteScalar(); mycon.Close(); private void textBox1_TextChanged(object sender, EventArgs e) public partial class 学生库存 : Form public string user3; public 学生库存() InitializeComponent(); string strCon = Data Source=localhost;Initial Catalog=图书管理系统;Integrated Security=True; SqlConnection mycon; SqlDataAdapter myda; SqlCommand cmd; DataSet myds; static int counts = 0; int MaxValue; int count; private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) private void 总体显示() textBox5.Text = user3; string sql = select 书号,书名,作者,出版社,类别 from 图书 where 书号not in (select 书号from 图书借阅) ; mycon = new SqlConnection(strCon); myda = new SqlDataAdapter(sql, mycon); myds = new DataSet(); myda.Fill(myds); dataGridView1.DataSource = myds.Tables0; private void 详细显示(int sta) myda = new SqlDataAdapter(select * from 图书where 书号not in (select 书号from 图书借阅) , mycon); myds = new DataSet(); myda.Fill(myds); textBox1.Text = myds.Tables0.Rowssta0.ToString(); textBox2.Text = myds.Tables0.Rowssta1.ToString(); textBox3.Text = myds.Tables0.Rowssta2.ToString(); textBox4.Text = myds.Tables0.Rowssta3.ToString(); comboBox1.Text = myds.Tables0.Rowssta4.ToString(); private void 学生库存_Load(object sender, EventArgs e) / 不可编辑(); 总体显示(); 详细显示(1); mycon = new SqlConnection(strCon); mycon.Open(); SqlCommand command = new SqlCommand(select Count(*) from 图书 where 书号not in (select 书号from 图书借阅) , mycon); MaxValue = Convert.ToInt32(command.ExecuteScalar(); mycon.Close(); private void button1_Click_1(object sender, EventArgs e) SqlCommand mycom; SqlConnection mycon; mycon = new SqlConnection(strCon); mycon.Open(); string strDel = delete from 图书where 书号= + textBox1.Text; mycom = new SqlCommand(strDel, mycon); mycom.ExecuteNonQuery(); mycon.Close(); MaxValue -= 1; 详细显示(MaxValue - 1); 总体显示(); SqlConnection mycon1; mycon1 = new SqlConnection(strCon); mycon1.Open(); string strInsert = insert into 图书借阅(学号,书号,书名) values( + textBox5.Text + , + textBox1.Text + , + textBox2.Text + ); SqlCommand mycom1; mycom1 = new SqlCommand(strInsert, mycon1); mycom1.ExecuteNonQuery(); mycon1.Close(); /学生个人借阅图书grjy = new 学生个人借阅图书); /grjy.user3 = textBox1.Text; /grjy.user4 = textBox2.Text; /grjy.ShowDialog(); private void dataGridView1_CellClick_1(object sender, DataGridViewCellEventArgs e) try textBox1.Text = myds.Tables0.Rowse.RowIndex0.ToString(); textBox2.Text = myds.Tables0.Rowse.RowIndex1.ToString(); textBox3.Text = myds.Tables0.Rowse.RowIndex2.ToString(); textBox4.Text = myds.Tables0.Rowse.RowIndex3.ToString(); comboBox1.Text = myds.Tables0.Rowse.RowIndex4.ToString(); catch (Exception es) MessageBox.Show(请点击正确的位置, 警告, MessageBoxButtons.OK, MessageBoxIcon.Warning); private void dataGridView1_CellContentClick_1(object sender, DataGridViewCellEventArgs e) 总体显示(); string str1; for (int i = 1; i 1) dataGridView1.DataSource = ds.Tables0; catch (Exception ex) throw new Exception(ex.Message); finally con.Close(); con.Dispose(); da.Dispose(); public 所有图书) InitializeComponent(); string strCon = Data Source=localhost;Initial Catalog=图书管理系统;Integrated Security=True; SqlConnection mycon; SqlDataAdapter myda; SqlCommand cmd; DataSet myds; static int counts = 0; int MaxValue; int count; private void 总体显示() string sql = select 书号,书名,作者,出版社,类别 from 图书; mycon = new SqlConnection(strCon); myda = new SqlDataAdapter(sql, mycon); myds = new DataSet(); myda.Fill(myds); dataGridView1.DataSource = myds.Tables0; private void 详细显示(int sta) myda = new SqlDataAdapter(select * from 图书, mycon); myds = new DataSet(); myda.Fill(myds); textBox1.Text = myds.Tables0.Rowssta0.ToString(); textBox2.Text = myds.Tables0.Rowssta1.ToString(); textBox3.Text = myds.Tables0.Rowssta2.ToString(); textBox4.Text = myds.Tables0.Rowssta3.ToString(); comboBox1.Text = myds.Tables0.Rowssta4.ToString(); private void 图书类别() comboBox1.Items.Add(计算机); comboBox1.Items.Add(文学); comboBox1.Items.Add(法学); comboBox1.Items.Add(外语); comboBox1.Items.Add(经济); comboBox1.Items.Add(数学); comboBox1.Items.Add(语言); comboBox1.DropDownStyle = ComboBoxStyle.DropDownList; private void 不可编辑() textBox1.ReadOnly = true; textBox2.ReadOnly = true; textBox3.ReadOnly = true; textBox4.ReadOnly = true; private void 不可编辑() textBox2.ReadOnly = false; textBox3.ReadOnly = false; textBox4.ReadOnly = false; private void 所有图书Load(object sender, EventArgs e) 不可编辑(); 总体显示(); 详细显示(1); mycon = new SqlConnection(strCon); mycon.Open(); SqlCommand command = new SqlCommand(select Count(*) from 图书, mycon); MaxValue = Convert.ToInt32(command.ExecuteScalar(); mycon.Close(); private void button1_Click(object sender, EventArgs e) 图书增加 tszj = new 图书增加(); tszj.ShowDialog(); count = 1; private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) private void button3_Click_1(object sender, EventArgs e) if (MessageBox.Show(你确定要删除此记录吗?, 提示信息, MessageBoxButtons.YesNo, MessageBoxIcon.Information) = DialogResult.Ye

温馨提示

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

评论

0/150

提交评论