当前位置:文档之家› 教学设备管理系统

教学设备管理系统

景德镇陶瓷学院实践周课程设计报告教学设备管理系统专业:计算机科学与技术班级: 10计科学号: 201030457109 姓名:陈。

指导教师:何福保,胡开华2013年10月30日一、系统设计目的:为适应学校设备管理的需要,提高设备管理员的工作效率,提高设备的利用率,便于设备的合理调配和购买,在借鉴同类产品的先进经验的基础上,利用设备处现有的数据资源结合新的计算机及网络和数据库技术,设计开发了办公设备管理系统,力求用户界面友好,操作简单,维护方便,推动湖北民族学院的设备管理工作向自动化、规范化和科学化方向发展。

二、系统功能:1、人员的登录与管理2、实现设备的录入、删除、修改等基本操作。

3、能够对设备进行方便的检索。

4、能够输出设备分类明细表。

三、数据库设计数据库的名称:mydata1、用户表2、设备借还表3、设备信息四、功能界面设计1、系统登录界面(1)用户登录的窗口界面设计如图1.1所示:2、主界面(1)主界面的窗口界面设计如图1.2所示:(2)功能及设计说明在该界面中,用户登入该界面后,将进行用户注册,用户密码修改,设备增、删、改操作以及信息查询,用户将更方便的进行各种操作。

3、用户注册及密码修改(1)密码修改的窗口界面设计如图1.3所示:(2)用户注册的窗口界面设计如图1.4所示:(3)代码public partial class Form5 : Form{public Form5(){InitializeComponent();}private void button1_Click(object sender, EventArgs e){string strConnection = "Provider=Microsoft.Jet.OleDb.4.0;";strConnection += @"Data Source=mydata.mdb";OleDbConnection objConnection = new OleDbConnection(strConnection); //建立连接objConnection.Open(); //打开连接OleDbCommand sqlcmd = new OleDbCommand(@"UPDA TE 用户表SET 密码='"+ this.textBox3.Text + "'where 用户名='"+ this.textBox1.Text + "'", objConnection); //sql语句OleDbDataReader reader = sqlcmd.ExecuteReader(); //执行查询OleDbDataReader reader = sqlcmd.ExecuteReader();MessageBox.Show("修改成功");this.Close();}}4、设备的增加、删改、查询(1)设备增、删、查的界面设计如图1.5所示:(2)功能及设计说明方便管理员及用户进行快速、便捷、有效的数据查询。

(3)代码public partial class Form4 : Form{public Form4(){InitializeComponent();}private void Form4_Load(object sender, EventArgs e){// TODO: 这行代码将数据加载到表“mydataDataSet1.设备信息表”中。

您可以根据需要移动或移除它。

this.设备信息表TableAdapter1.Fill(this.mydataDataSet1.设备信息表);}private void button1_Click(object sender, EventArgs e){if (boBox1.SelectedIndex.ToString() == "0") //选择了按设备编号{DataSet ds = new DataSet();string strConnection = "Provider=Microsoft.Jet.OleDb.4.0;";strConnection += @"Data Source=mydata.mdb";OleDbConnection conn = new OleDbConnection(strConnection); //建立连接conn.Open(); //打开连接string sql;sql = "select * from 设备信息表where 设备编号like '%" + this.textBox8.Text + "%'";OleDbDataAdapter da = new OleDbDataAdapter(sql, conn);da.Fill(ds, "biao");if (conn.State.ToString() == "Open")conn.Close();dataGridView1.DataSource = ds.Tables[0].DefaultView;}if (boBox1.SelectedIndex.ToString() == "1") //选择了按设备名{DataSet ds = new DataSet();string strConnection = "Provider=Microsoft.Jet.OleDb.4.0;";strConnection += @"Data Source=mydata.mdb";OleDbConnection conn = new OleDbConnection(strConnection); //建立连接conn.Open(); //打开连接string sql;sql = "select * from 设备信息表where 设备名like '%" + this.textBox8.Text + "%'";OleDbDataAdapter da = new OleDbDataAdapter(sql, conn);da.Fill(ds, "biao");if (conn.State.ToString() == "Open")conn.Close();dataGridView1.DataSource = ds.Tables[0].DefaultView;}}private void button2_Click(object sender, EventArgs e){string A = this.textBox1.Text.ToString();string B = this.textBox2.Text.ToString();string C = this.textBox3.Text.ToString();string D = this.textBox4.Text.ToString();string E = this.textBox5.Text.ToString();string F = this.textBox6.Text.ToString();string G = this.textBox7.Text.ToString();string strConnection = "Provider=Microsoft.Jet.OleDb.4.0;";strConnection += @"Data Source=mydata.mdb";OleDbConnection objConnection = new OleDbConnection(strConnection); //建立连接objConnection.Open(); //打开连接OleDbCommand sqlcmd = new OleDbCommand(@"insert into 设备信息表(设备编号,设备名,单价,购买日期,生产厂家,购买人,数量) values('" + A + "','" + B + "','" + C + "','" + D + "','" + E + "','" + F + "','" + G + "')", objConnection); //sql语句OleDbDataReader reader = sqlcmd.ExecuteReader(); //执行查询OleDbDataReader reader = sqlcmd.ExecuteReader();MessageBox.Show("设备信息添加成功!");//this.Close();}private void button3_Click(object sender, EventArgs e){string A = this.textBox2.Text.ToString();string B = this.textBox3.Text.ToString();string C = this.textBox1.Text.ToString();string D = this.textBox4.Text.ToString();string E = this.textBox5.Text.ToString();string F = this.textBox6.Text.ToString();string G = this.textBox7.Text.ToString();string strConnection = "Provider=Microsoft.Jet.OleDb.4.0;";strConnection += @"Data Source=mydata.mdb";OleDbConnection objConnection = new OleDbConnection(strConnection); //建立连接objConnection.Open(); //打开连接OleDbCommand sqlcmd = new OleDbCommand(@"update 设备信息表set 设备名='" + A + "',单价='" + B + "',购买日期='" + D + "' ,生产厂家='" + E + "',购买人='" + F + "',数量='" + G+ "'where 设备编号='" + C + "'", objConnection); //sql语句OleDbDataReader reader = sqlcmd.ExecuteReader(); //执行查询OleDbDataReader reader = sqlcmd.ExecuteReader();MessageBox.Show("修改成功");//this.Close();}}5、借还管理查询(1)借还查询界面设计如图1.6所示(2)代码private void button1_Click(object sender, EventArgs e){if (boBox1.SelectedIndex.ToString() == "0") //选择了按设备编号{DataSet ds = new DataSet();string strConnection = "Provider=Microsoft.Jet.OleDb.4.0;";strConnection += @"Data Source=mydata.mdb";OleDbConnection conn = new OleDbConnection(strConnection); //建立连接conn.Open(); //打开连接string sql;sql = "select * from 设备借还表where 设备编号like '%" + this.textBox1.Text + "%'";OleDbDataAdapter da = new OleDbDataAdapter(sql, conn);da.Fill(ds, "biao");if (conn.State.ToString() == "Open")conn.Close();dataGridView1.DataSource = ds.Tables[0].DefaultView;}if (boBox1.SelectedIndex.ToString() == "1") //选择了按借用人{DataSet ds = new DataSet();string strConnection = "Provider=Microsoft.Jet.OleDb.4.0;";strConnection += @"Data Source=mydata.mdb";OleDbConnection conn = new OleDbConnection(strConnection); //建立连接conn.Open(); //打开连接string sql;sql = "select * from 设备借还表where 借用人like '%" + this.textBox1.Text + "%'";OleDbDataAdapter da = new OleDbDataAdapter(sql, conn);da.Fill(ds, "biao");if (conn.State.ToString() == "Open")conn.Close();dataGridView1.DataSource = ds.Tables[0].DefaultView;}}private void button2_Click(object sender, EventArgs e){string A = this.textBox2.Text.ToString();string B = this.textBox3.Text.ToString();string C = this.textBox4.Text.ToString();string D = this.textBox5.Text.ToString();string E = this.textBox6.Text.ToString();string F = this.textBox7.Text.ToString();string G = this.textBox8.Text.ToString();string strConnection = "Provider=Microsoft.Jet.OleDb.4.0;";strConnection += @"Data Source=mydata.mdb";OleDbConnection objConnection = new OleDbConnection(strConnection); //建立连接objConnection.Open(); //打开连接OleDbCommand sqlcmd = new OleDbCommand(@"insert into 设备借还表(借用人,设备编号,经手人,用途,借用设备名称,借用日期,归还日期) values('" + A + "','" + B + "','" + C + "','" + D + "','" + E + "','" + F + "','"+ G + "')", objConnection); //sql语句OleDbDataReader reader = sqlcmd.ExecuteReader(); //执行查询OleDbDataReader reader = sqlcmd.ExecuteReader();MessageBox.Show("添加成功!");//this.Close();}五、课程设计总结通过两个星期的努力,将以前学习感到很抽象的课程,如面向对象程序设计等变得清晰起来。

相关主题