try { }
catch(System.Exception E) { } finally { }
this.sqlConnection1.Close(); Console.WriteLine(E.ToString()); this.sqlConnection1.Open(); this.sqlCommand1.ExecuteNonQuery();
} } }
6.4 读者信息模块
读者信息模块包含了读者信息和读者信息查询两个子模块
读者信息:添加新读者的读者号,姓名,性别,所在系,年龄并将修改后的信息入库保存
读者信息查询:可按照读者号,姓名,性别,所在系,年龄五种类型进行查询,可删除读者的信息并将修改后的信息保存,如图6.4。
读者信息 读者信息 读者信息查询 添加 重置 查询 重置 全部 删除 退出
图6.4 读者信息
26
黄淮学院计算机科学系课程设计说明书
代码: namespace 登陆
{
class duzhe {
private SqlConnection sqlConnection1 = null; private SqlCommand sqlCommand1 = null; private string strSql = null; public duzhe() {
this.sqlConnection1 = new SqlConnection(dbconnection.connection); this.sqlCommand1 = new SqlCommand();
this.sqlCommand1.CommandType = CommandType.Text; this.sqlCommand1.Connection = this.sqlConnection1;
// TODO: 在此处添加构造函数逻辑 // }
public void dz_add(string Rno, string Rname, string Rsex, string Rdep, int Rage) {
//DateTime Ldate = Convert.ToDateTime(DateTime.Now.ToString(\ this.strSql = \ +
\ + Rno + \ + Rname + \ + Rsex + \ + Rdep + \ + Rage + \; this.sqlCommand1.CommandText = this.strSql; try {
this.sqlConnection1.Open(); this.sqlCommand1.ExecuteNonQuery(); //Lno_add(Lno); }
catch (System.Exception E) {
Console.WriteLine(E.ToString()); } finally {
this.sqlConnection1.Close(); } }
public void dz_del(string Rno) {
this.strSql = \ + \ + Rno + \; this.sqlCommand1.CommandText = this.strSql; try
27
{
this.sqlConnection1.Open(); this.sqlCommand1.ExecuteNonQuery(); }
catch (System.Exception E) {
Console.WriteLine(E.ToString()); } finally {
this.sqlConnection1.Close(); } } } }
7 系统测试
具体操作如下:
(1)打开数据库SQL Service 2005,数据库右键选择‘附加’,选择要添加的数据库,如图
图1 添加数据库
28
黄淮学院计算机科学系课程设计说明书
(2)打开VS 2008 选择 文件>打开->文件,如图2
图2 用VS 2008打开登陆文件
(3)编译后可进入登陆界面,输入用户名及密码就可以进入图书管理系统了见图3和图4
29
图3 登陆界面
图4 图书借阅管理界面
(4)进人 图书信息->图书入库 界面,可以向管理系统中添加新的图书,如图5-1
30
百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说综合文库C#图书管理系统 C#课程设计 图书管理系统(6)在线全文阅读。
相关推荐: