




已阅读5页,还剩18页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
数据库课程设计报告1.需求分析说明书31.1.数据库分析31.2. 系统功能分析32.e-r模型设计33.数据库设计44.系统功能实现54.1连接数据库54.2用户登录界面64.3系统主界面94.4借还图书94.4.1. 借阅图书104.4.2当前借阅124.4.3归还处理134.5书库操作154.5.1书库管理154.5.2书库列表164.5.3查找图书174.6. 读者操作184.6.1读者管理184.6.2读者列表194.6.3读者查询204.7. 用户管理214.7.1系统用户管理214.7.2系统设置23课程设计题目:图书馆管理系统1. 需求分析说明书1.1. 数据库分析通过对图书馆管理系统功能的分析和实际调查情况,所设计的图书馆管理系统包括以下数据库信息: (1)管理员基本信息:管理员id、密码。(2)图书信息:包括图书id、图书名称、作者、单价、借书人、以及借出标记。(3)借书信息:借书人、所借的的书名。(4)读者信息:包括读者编号、读者姓名、班级、以及所借书籍。(5)系统设置:启动动画、背景图片、开机登录窗口初始。1.2. 系统功能分析本系统功能模块取决于登陆者的身份,若以管理员身份登录,拥有以下功能:(1) 书库管理:包括新书登记、图书信息查询、修改图书信息等功能。(2) 读者管理:其提供办理借阅证、借阅证信息查询、修改借阅证等功能。(3) 系统管理:包括添加账号、修改密码和退出系统等功能。 若以读者身份登录本系统,拥有以下功能:(1) 借书功能:查询想要借的书本,然后即可借阅。(2) 借阅查询:查询已借书本。(3) 还书功能:归还所借书籍。 2. e-r模型设计 3. 数据库设计基本表的设计如下:(1) 管理员基本信息表 管理员基本信息表(users)包含了图书馆管理员的基本信息,其结构如表1所示。表1 管理员基本信息表字 段 名 称数 据 类 型可 否 为 空约 束 条 件说 明name_namevarchar2(50)not null主键姓名name_passvarchar2(50)not null无密码(2) 图书信息表图书信息表(book)包含了图书馆所有图书的基本信息,用来方便读者查询和借阅,其结构如表2所示。表2:图书信息表字 段 名 称数 据 类 型可 否 为 空约 束 条 件说 明book_novarchar(50)not null主键书籍号码book_namevarchar(50)not null无书名book_jgvarchar(50)无无书籍价格book_znamevarchar(50)无无作者book_jnamevarchar(50)无无借书人flagvarchar(50)无无借出标记(3) 读者信息表读者信息表(readname)包含了所有读者的借阅卡信息,用来方便读者借阅和管理员,其结构如表3所示。表3:读者信息表字 段 名 称数 据 类 型可 否 为 空约 束 条 件说 明name_novarchar(50)not null主键读者号码name_namevarchar(50)not null无姓名name_classvarchar(50)not null无班级name_bookvarchar(50)not null无所借书籍(4) 借书信息表借书信息表(namebook)包含了每个读者所借书籍信息(最多五本),其结构如表4所示。表4:借书信息表字 段 名 称数 据 类 型可 否 为 空约 束 条 件说 明namevarchar(50)无无借书人姓名book1varchar(50)无无书本1book2varchar(50)无无书本2book3varchar(50)无无书本3book4varchar(50)无无书本4book5varchar(50)无无书本5 (5) 系统初始表 系统初始表(sz)包含了启动程序的初始设置值,其结构表如表5所示。表5 罚单信息表字 段 名 称数 据 类 型可 否 为 空约 束 条 件说 明startvarchar(50)无无登录窗口选择bmpvarchar(50)无无背景图片选择flagvarchar(50)无无开机动画标记4. 系统功能实现4.1连接数据库 该系统是通过powerbuilder和sql server2000共同制作完成的。由sqlserver设计完数据库book后,将book添加到odbc数据源中。在powerbuilder中database中的odbc中新建book_profile,连接数据源book,即完成了powerbuilder和数据库的连接。并通过以下代码实现数据源的连接:sqlca.dbms = odbcsqlca.autocommit = falsesqlca.dbparm = connectstring=dsn=book;uid=zhuzi;pwd=123connect using sqlca;if sqlca.sqlcode0 thenmessagebox(错误,数据库连接错误,请检查后重试!,stopsign!)returnend ifopen(w_splash)4.2用户登录界面本系统包括两个登陆界面:管理员登陆界面和读者登陆界面。管理员登陆后可以实现书库管理,读者管理,与系统管理,界面如下:完成代码如下: string id,getname,fftime d_date d_date=now()ff=string(d_date)id=trim(sle_no.text)getname=trim(sle_name.text)if id= or id= thenmessagebox(系统提示,请输入读者证号!)returnend if/密码不能为空if getname= or getname= thenmessagebox(系统提示,请输入姓名!)returnend if/读者登陆select name_no,name_nameinto :ls_no,:ls_namefrom readnamewhere name_no=:id;if sqlca.sqlcode0 then messagebox(系统提示,无此读者!)sle_no.text=sle_name.text=sle_no.setfocus()returnend ifif getnametrim(ls_name) thenmessagebox(警告,姓名错误!)sle_name.text=sle_name.setfocus()returnend ifmessagebox(welcome!,欢迎你的到来,+ls_name+!+现在是:+ff) m_main.m_1.m_2.enabled=truem_main.m_1.m_还书处理.enabled=truem_main.m_1.m_当前借阅.enabled=truem_main.m_书库操作.m_书库管理.enabled=false m_main.m_读者操作.m_读者管理.enabled=false m_main.m_用户管理.m_系统用户管理.enabled=false w_main.title=图书馆管理系统-当前读者: +ls_namename=ls_nameclose(w_ptlogin)读者登陆界面:读者登录后可以实现借阅图书,借书查询,还书功能。string id,getpasswordid=trim(sle_name.text)getpassword=trim(sle_pw.text)if id= or id= thenmessagebox(系统提示,请输入用户名!)returnend if/密码不能为空if getpassword= or getpassword= thenmessagebox(系统提示,请输入密码!)returnend if/管理员登陆select name_name,name_passinto :ls_name,:ls_passfrom userswhere name_name=:id;if sqlca.sqlcode0 then messagebox(系统提示,无此管理员!)sle_pw.text=sle_name.text=sle_name.setfocus()returnend ifif getpasswordtrim(ls_pass) thenmessagebox(警告,口令错误!)sle_pw.text=sle_pw.setfocus()returnend if/进入管理员管理界面messagebox(系统登入成功,欢迎你的到来,+ls_name+!) m_main.m_1.m_2.enabled=false m_main.m_1.m_当前借阅.enabled=false m_main.m_1.m_还书处理.enabled=falsem_main.m_书库操作.m_书库管理.enabled=true m_main.m_读者操作.m_读者管理.enabled=true m_main.m_用户管理.m_系统用户管理.enabled=true w_main.title=图书馆管理系统-当前管理员: +ls_nameclose(w_gjlogin)4.3系统主界面系统主界面包括如下功能:(1) 系统处理:系统初始化,读者登录,管理员登陆,退出。(2) 借还图书:借阅图书,当前借阅,还书处理。(3) 书库操作:书库管理,书库列表,查找图书。(4) 读者操作:读者管理,读者列表,读者查询。(5) 用户管理:系统用户管理,系统设置。(6) 帮助:关于,帮助文件。系统初始化后,相当于当前登录到系统中的用户既不是管理员也不是读者,所以只能实现查看图书以及查询读者的功能。初始化通过以下代码实现:m_main.m_书库操作.m_书库管理.enabled=falsem_main.m_读者操作.m_读者管理.enabled=falsem_main.m_用户管理.m_系统用户管理.enabled=falsem_main.m_1.m_2.enabled=falsem_main.m_1.m_当前借阅.enabled=falsem_main.m_1.m_还书处理.enabled=falsew_main.title=图书馆管理系统name=0messagebox(提示,系统初始化成功!)。其它功能以下详细介绍。4.4借还图书借还图书包括借阅图书,当前借阅,归还处理三个模块。 4.4.1. 借阅图书上图为借阅图书截图,该模块可以实现以下功能:首先在输入栏中输入想要借的书籍,点击查询即可获得,然后点击“借出”即可借阅。一个读者最多可借五本书。其中,查询书籍的代码是通过书名查询的,实现代码如下:string lookforconditionlookforcondition=book_name+=+sle_1.text+dw_1.setfilter(lookforcondition)filter(dw_1)if dw_1.retrieve()=0 then messagebox(提示,图书馆没有此书!)。借书功能通过以下代码实现:string a,a1,a2,a3,a4,a5int b=0integer c=0a=trim(sle_1.text) /a为要借的书select book1,book2,book3,book4,book5into :a1,:a2,:a3,:a4,:a5from namebookwhere name=:name; /a1,a2,a3,a4,a5为已经借的书if a1 then c=c+1if a2 then c=c+1if a3 then c=c+1if a4 then c=c+1if a5 then c=c+1if c=5 thenmessagebox(,您所借的书不能超过五本!)b=1goto aaelseif a=a1 or a=a2 or a=a3 or a=a4 or a=a5 thenmessagebox(,您已经借了这本书!)b=1 goto aaend ifchoose case ccase 0 update namebook set book1=:a where name=:name; update book set book_jname=:name where book_name=:a; update book set flag=已借出 where book_name=:a;case 1 update namebook set book2=:a where name=:name; update book set book_jname=:name where book_name=:a; update book set flag=已借出 where book_name=:a;case 2 update namebook set book3=:a where name=:name; update book set book_jname=:name where book_name=:a; update book set flag=已借出 where book_name=:a;case 3 update namebook set book4=:a where name=:name; update book set book_jname=:name where book_name=:a; update book set flag=已借出 where book_name=:a;case 4 update namebook set book5=:a where name=:name; update book set book_jname=:name where book_name=:a; update book set flag=已借出 where book_name=:a;end chooseaa:if b=0 then messagebox(成功,借书成功!)dw_1.retrieve()return4.4.2当前借阅当前借阅模块显示当前读者所借的书籍:姓名栏中即为当前登录的读者姓名,其余栏中为读者所借的书籍,该对话框的open()函数编码如下:string lookforconditionthis.x=(w_main.workspacewidth() - this.width)/2this.y=(w_main.workspaceheight() - w_main.mdi_1.microhelpheight - this.height)/2 - 50dw_1.settransobject(sqlca)lookforcondition=name+=+ls_name+ /name即为读者的name name=lsnamedw_1.setfilter(lookforcondition) /过滤dw_1filter(dw_1)dw_1.retrieve()该段代码实现数据窗口中显现的为当前读者的借书信息。4.4.3归还处理勾选想要归还的书名,点击确认还这些书即可完成归还功能:string aif cbx_1.checked=true then a=dw_1.getitemstring(dw_1.getrow(),book1) update namebook set book1=null where name=:ls_name; update book set book_jname=null where book_name=:a; update book set flag=未借出 where book_name=:a;end ifif cbx_2.checked=true then a=dw_1.getitemstring(dw_1.getrow(),book2) update namebook set book2=null where name=:ls_name; update book set book_jname=null where book_name=:a; update book set flag=未借出 where book_name=:a;end ifif cbx_3.checked=true then a=dw_1.getitemstring(dw_1.getrow(),book3) update namebook set book3=null where name=:ls_name; update book set book_jname=null where book_name=:a; update book set flag=未借出 where book_name=:a;end ifif cbx_4.checked=true then a=dw_1.getitemstring(dw_1.getrow(),book4) update namebook set book4=null where name=:ls_name; update book set book_jname=null where book_name=:a; update book set flag=未借出 where book_name=:a;end ifif cbx_5.checked=true then a=dw_1.getitemstring(dw_1.getrow(),book5) update namebook set book5=null where name=:ls_name; update book set book_jname=null where book_name=:a; update book set flag=未借出 where book_name=:a;end ifif cbx_1.checked=true or cbx_2.checked=true or cbx_3.checked=true or cbx_4.checked=true or cbx_5.checked=true then messagebox(提示,成功!)else messagebox(提示,您还没有还书!)end ifclose(parent)4.5书库操作书库操作包括书库管理,书库列表,书库查询三个功能。4.5.1书库管理书库管理必须通过管理员权限才能够实现:书库管理可以实现增加图书,删除图书的功能。新增记录通过以下代码实现:dw_1.scrolltorow(dw_1.insertrow(0)dw_1.setfocus()删除记录通过以下代码实现:deleterow(dw_1,dw_1.getrow()保存实现编码:if update(dw_1)=1 thendw_1.resetupdate() commit;messagebox(成功,数据已成功保存!)elserollback;messagebox(失败,数据保存失败!)end if退出实现编码:int mcount,updateornot /修改后没有保存的行数,是否修改mcount=w_book.dw_1.modifiedcount()if mcount=0 then/无未保存的修改close(w_book)elseif mcount0 thenupdateornot=messagebox(保存修改,您已修改数据,是否保存?,question!,yesnocancel!)if updateornot=1 then/保存if update(w_book.dw_1,true,false)=1 then/保存成功,提交修改w_book.dw_1.resetupdate()commit;elserollback;messagebox(错误!,保存失败)end ifclose(w_book)elseif updateornot=2 then/不保存rollback;close(w_book) end ifend if4.5.2书库列表书库列表模块实现显示书库中所有图书的信息,截图如下:4.5.3查找图书该模块实现搜索图书的功能,有四种搜错方式:按书号,按书名,按价格,按作者。按书号通过以下编码实现:string lookforconditionlookforcondition=book_no+=+sle_1.text+dw_1.setfilter(lookforcondition)filter(dw_1)if dw_1.retrieve()=0 then messagebox(提示,图书馆没有此书!)按书名通过以下编码实现:string lookforconditionlookforcondition=book_name+=+sle_3.text+dw_1.setfilter(lookforcondition)filter(dw_1)if dw_1.retrieve()=0 then messagebox(提示,图书馆没有此书!)按价格通过如下实现:string lookforconditionlookforcondition=book_jg+ddplb_1.text+sle_4.textdw_1.setfilter(lookforcondition)filter(dw_1)if dw_1.retrieve()=0 then messagebox(提示,图书馆没有此书!)按作者:string lookforconditionlookforcondition=book_zname+=+sle_5.text+dw_1.setfilter(lookforcondition)filter(dw_1)if dw_1.retrieve()=0 then messagebox(提示,图书馆没有此书!)4.6. 读者操作读者操作包括三个功能:读者管理,读者列表,读者查询。4.6.1读者管理读者管理必须有管理员权限才能进行操作,实现读者的增删功能。新增功能:dw_1.scrolltorow(dw_1.insertrow(0)dw_1.setfocus()删除功能:deleterow(dw_1,dw_1.getrow()保存:string fdw_1.scrolltorow(dw_1.rowcount()f=dw_1.getitemstring(dw_1.getrow(),name_name)insert namebook(name)values (:f);if update(dw_1)=1 thendw_1.resetupdate() commit;messagebox(成功,数据已成功保存!)elserollback;messagebox(失败,数据保存失败!)end if退出编码实现如下:int mcount,updateornot /修改后没有保存的行数,是否修改mcount=w_book.dw_1.modifiedcount()if mcount=0 then/无未保存的修改close(w_book)elseif mcount0 thenupdateornot=messagebox(保存修改,您已修改数据,是否保存?,question!,yesnocancel!)if updateornot=1 then/保存if update(w_book.dw_1,true,false)=1 then/保存成功,提交修改w_book.dw_1.resetupdate()commit;elserollback;messagebox(错误!,保存失败)end ifclose(w_book)elseif updateornot=2 then/不保存rollback;close(w_book) end ifend if4.6.2读者列表显示所有读者信息,并提供打印功能。4.6.3读者查询按三种方式进行查询:图书证号,姓名,班级。通过变量p标识使用哪种查询方式:图书证号:p=1sle_1.setfocus()sle_1.enabled=truesle_2.enabled=falsesle_3.enabled=false姓名:p=2sle_2.setfocus()sle_2.enabled=truesle_1.enabled=falsesle_3.enabled=false班级:p=3sle_3.setfocus()sle_3.enabled=truesle_2.enabled=falsesle_1.enabled=false查找功能通过以下编码实现:choose case pcase 1abc=name_no+=+sle_1.text+case 2abc=name_name+=+sle_2.text+case 3abc=name_class+=+sle_3.text+end choosemessagebox(,abc)dw_1.setfilter(abc)filter(dw_1)if dw_1.retrieve()=0 then messagebox(提示,无此记录!)4.7. 用户管理用户管理包括系统用户管理和系统设置两个功能。4.7.1系统用户管理系统用户管理只能通过管理员权限操作。可以实现对系统用户,即管理员的增加,删除和修改等功能。增加:dw_1.scrolltorow(dw_1.insertrow(0)dw_1.setfocus()删除:deleterow(dw_1,dw_1.getrow()保存:if update(dw_1)=1 thendw_1.resetupdate() commit;messagebox(成功,数据已成功保存!)elserollback;messagebox(失败,数据保存失败!)end if关闭实现编码:int mcount,updateornot /修改后没有保存的行数,是否修改mcount=w_book.dw_1.modifiedcount()if mcount=0 then/无未保存的修改close(w_book)elseif mcount0 thenupdateornot=messagebox(保存修改,您已修改数据,是否保存?,question!,yesnocancel!)if updateornot=1 then/保存
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025年兰州石化分公司秋季高校毕业生招聘350人笔试参考题库附带答案详解
- 2025年大学涉外警务专业题库- 海外持枪犯罪与涉外警务合作
- 2025山东青科控股集团有限公司招聘26人考试历年参考题附答案详解
- 2025年大学出入境管理专业题库- 移民与出入境管理现状探讨
- 2025年医保知识竞赛题库及答案:政策调整下的医保改革路径分析
- 2025年会计职称考试《初级会计实务》实战模拟试题型
- 2025年会计职称考试《初级会计实务》全真模拟试卷:2025年考前冲刺题库
- 2024自考专业(公共关系)考试黑钻押题(考点精练)附答案详解
- 2024-2025学年度自考专业(法律)常考点试卷及答案详解(全优)
- 2025导游资格考试复习提分资料带答案详解(A卷)
- 2025年合肥公交集团有限公司驾驶员招聘180人笔试参考题库附带答案详解
- GB/T 46104-2025电解水制氢系统功率波动适应性测试方法
- 信贷档案管理培训课件
- 2025年网络安全监测预警体系建设实施方案评估报告
- 2025年会计继续教育网络答题真题及答案
- (2025)安全知识竞赛试题(附完整答案)
- 2025年辅警招聘考试(行政职业能力测验)复习题及答案
- 2025年海南事业单位联考笔试历年典型考题及考点剖析附带答案详解
- 2025年水发集团有限公司招聘(216人)备考练习试题及答案解析
- 试验检测资金管理办法
- 护理时政面试题库及答案
评论
0/150
提交评论