前往Shuct.Net首页

Shudepb PB反编译专家长时间以来,为业内同类软件事实上的唯一选择.细节,彰显专业.态度,决定品质.

关于PowerBuilder的搜索

利用PowerBuilder开发图书管理系统_DZ永恒杀星_新浪博客 加载中… 蔡さんのブログ http://blog.sina.com.cn/caijinlin [订阅][手机订阅] 首页 博文目录 图片 关于我 个人资料 DZ永恒杀星 Qing 微博 加好友 发纸条 写留言 加关注 博客等级: 博客积分:121 博客访问:3,615 关注人气:0 天天美食 精彩图文 相关博文 更多>> 推荐博文 因为我,我选择了自由 蒋方舟 胡锡进,我等着你接招 李承鹏 第1068篇&bull;污霾 马未都 罗援对设立“国家公祭日”的解读 罗援 到美国生孩子 易中天 普京为何对乌克兰引而不发 关健斌 论欲望 李银河 外貌协会 苗炜 香港吃了一闷棍 程鹤麟 军队改革将给文艺兵带来什么 公方彬 查看更多>> 谁看过这篇博文 加载中… 正文 字体大小:大 中 小 利用PowerBuilder开发图书管理系统 (2006-08-27 21:26:16)转载▼ 分类: 交流程序 利用PowerBuilder开发图书管理系统(部分功能代码) 具体源程序E-mail:cajil@sina.com 一、设计目的 根据数据库课程所学的概念、理论和方法,按照数据库设计的基本步骤,结合前端开发工具(PowerBuilder),设计出一个小型实用的数据库管理信息系统;使用现行教流行的数据库管理系统进行数据库管理操作(如建库、建立完整性约束,对数据库中数据进行查询,更改等操作);对SQL语言要有较深入的了解和掌握。使学生能理论联系实际,加深和巩固所学的理论知识,提高学生的实践能力和计算机的综合运用能力。 二、设计要求 利用PowerBuilder开发一个图书管理管理和查询系统 系统应具有以下功能: 1. 图书信息的录入和删除,读者相关信息的录入和删除(包括照片信息等) 2. 图书信息的检索(可以按不同的字段进行查询) 3. 图书的借还(不同读者的借阅级别设置,过期罚款的计算) 4. 数据的统计(超期读者的罚金,最热借阅书排名的图表显示) 5. 图书和读者的详细信息的浏览 6. 帮助信息 要求使用ASA8.0设计数据库和数据表,注意把握数据库的设计原则。 要求设计的程序界面友好,操作方便。 三、程序设计环境 CPU P3 750 256M 内存 PowerBuilder9.0 四、设计流程 1.数据库表设计 建立数据库DB 读者表reader表信息包含: (具体字段结构见下图) Reader: 读者编号 ——姓名 ——性别 ——类别—— 部门——联系电话——联系地址——注册日期——借书次数——允许借书最大数目——未还书数——欠费——图片信息 书籍信息表 book:(具体字段结构见下图)book: 图书编号——ISBN——书名——图书分类——作者——出版社——出版时间——图书价格——馆藏书数——可借出数——借出次数——图书封面照片 图书借阅表borrow:(具体字段结构见下图) Borrow: 序号——读者编号——图书编号——ISBN——书名——出版社——借书日期——应该还书日期 系统管理员admin表: admin: 序号——用户名——密码 2. 程序界面设计流程: 首先连接数据库 sqlca.dbms="odbc" sqlca.dbparm="connectstring='dsn=Db;uid=dba;pwd=sql'" connect; if sqlca.sqlcode<>0 then messagebox("error","不能连接到数据库") return end if 系统登陆界面设计 确定按纽的程序设计如下: string ls_admin,ls_password,temp_name,temp_password ls_admin=sle_admin_name.text ls_password=trim(sle_password.text) if ls_admin="" or ls_password="" then messagebox("","用户名和密码不能为空请重新输入!") sle_admin_name.setfocus() else select name,password into :temp_name,:temp_password from admin where name=:ls_admin using sqlca; if sqlca.sqlcode<>0 then messagebox("","用户名和密码错误,请重新输入!") sle_admin_name.text="" sle_password.text="" sle_admin_name.setfocus() end if open(search) close(parent) end if 借书功能的实现: int day rn=trim(sle_read_no.text) //sle_read_no.setfocus() choose case flag case 0 if len(sle_read_no.text)=8 and isnumber(sle_read_no.text) and flag=0 then select name,sex,class,partment,tel,addr,cost,reg_day,no_read,no_allow_max,no_unreturn into :name,:sex,:class,:partment,:tel,:addr,:cost,:reg_day,:no_read,:no_allow_max,:no_unreturn from reader where read_no=:rn using sqlca; if sqlca.sqlcode<>0 then messagebox("","查无此人") sle_read_no.text="" sle_read_no.setfocus() else temp_read_no=rn // read_class=class st_name.text=string(name) st_sex.text=string(sex) st_class.text=string(class) st_partment.text=string(partment) st_tel.text=string(tel) st_addr.text=string(addr) st_cost.text=string(cost) st_no_read.text=string(no_read) st_allow_max.text=string(no_allow_max) st_no_unreturn.text=string(no_unreturn) st_reg_day.text=string(reg_day) dw_1.settransobject(sqlca) dw_1.retrieve(rn) flag=1 sle_bianhao.setfocus() end if else if len(sle_read_no.text)>0 and flag=0 then messagebox("error","编号错误") sle_read_no.text="" sle_read_no.setfocus() end if end if case 1 if len(sle_bianhao.text)=5 and flag=1 then bh=trim(sle_bianhao.text) select isbn,bookname,book_class,author,publishment,publish_time,price,in_num,allow_out_num into :isbn,:bookname,:book_class,:author,:publishment,:publish_time,:price,:in_num,:allow_out_num from book where bianhao=:bh using sqlca; if sqlca.sqlcode<>0 then messagebox("","no find book") sle_bianhao.text="" sle_bianhao.setfocus() else // temp_book_bianhao=bh st_bookname.text=bookname st_book_class.text=book_class st_author.text=author st_publishment.text=publishment st_publish_time.text=string(publish_time) st_price.text=string(price) st_in_num.text=string(in_num) st_allow_out_num.text=string(allow_out_num) flag=3 end if else messagebox("","book num format error") sle_bianhao.text="" sle_bianhao.setfocus() end if case 3 if allow_out_num=0 then messagebox("error","此书已经借空!") flag=1 return end if //messagebox("",temp_book_bianhao+" "+temp_read_no) select id into :i from borrow where read_no=:temp_read_no and book_bianhao=:temp_book_bianhao using sqlca; if i<>0 then messagebox("","你已经借了此书,请归还后再借") st_no_read.text=string(no_read) st_allow_max.text=string(no_allow_max) st_no_unreturn.text=string(no_unreturn) sle_bianhao.text="" st_bookname.text="" st_book_class.text="" st_author.text="" st_publishment.text="" st_publish_time.text="" st_price.text="" st_in_num.text="" st_allow_out_num.text="" sle_bianhao.setfocus() temp_book_bianhao="" i=0 flag=1 return end if if no_allow_max - no_unreturn=0 then messagebox("error","您已到达最大借书数!") flag=1 return end if borrow_date=today() if read_class="教师" then day=20 else day=15 end if return_date=relativedate(borrow_date,day) no_unreturn+=1 no_read+=1 allow_out_num= allow_out_num - 1 //这里插入数据库 update reader set no_read=:no_read, no_unreturn=:no_unreturn where read_no=:rn; update book set allow_out_num=:allow_out_num where bianhao=:bh; insert into borrow (read_no,read_name,book_bianhao,book_isbn,book_name,book_publishment,borrow_date,return_date) values (:rn,:name,:bh,:isbn,:bookname,:publishment,:borrow_date,:return_date) using sqlca; if sqlca.sqlcode<>0 then messagebox("","插入数据错误") else messagebox("","借出一本书") dw_1.settransobject(sqlca) dw_1.retrieve(rn) st_no_read.text=string(no_read) st_allow_max.text=string(no_allow_max) st_no_unreturn.text=string(no_unreturn) sle_bianhao.text="" st_bookname.text="" st_book_class.text="" st_author.text="" st_publishment.text="" st_publish_time.text="" st_price.text="" st_in_num.text="" st_allow_out_num.text="" sle_bianhao.setfocus() flag=1 end if case else end choose 由于把按钮控件的大小设置为0且选中了default属性。所以在借书过程中只需使用ENTER回出键控制借书过程,比较方便。 还书界面和代码部分和借书基本相同只是在操作数据库处有不同。具体请看程序中代码部分。 程序中其他部分界面都是采用数据窗口对象构成的。 图书管理界面: 这里为了在数据窗口对象中显示图片在数据窗口对象的rbuttondown()事件中加入了以下代码 int li_bianhao int this_row this_row=dw_1.getrow() //messagebox("",this_row) li_bianhao=dw_1.getitemnumber(this_row,"bianhao") selectblob photo into:lb_manage_book_photo from book where bianhao=:li_bianhao using sqlca; if isNULL(lb_manage_book_photo) then //messagebox("","") p_1.picturename="image/nobook.bmp" else p_1.setpicture(lb_manage_book_photo) end if 总的系统集成: 注:程序中出现的书名和人名纯属虚构如有雷同纯属巧合 呵呵 一年前的代码找出来发的,准备陆续整理我的电脑里的小东东,有些都没有编译不成行。大家多多指教! 分享: 喜欢 阅读┊ 评论 ┊ 收藏 ┊转载 ┊ 喜欢▼ ┊打印┊举报 加载中,请稍候...... 前一篇:闪电!! 后一篇:在EditPlus里配置简单的各种程序开发调试平台 评论 重要提示:警惕虚假中奖信息 | [发评论] 评论加载中,请稍候... 发评论 | 登录名: 密码: 找回密码 注册 记住登录状态昵 称: 分享到微博 评论并转载此博文验证码: 请点击后输入验证码 收听验证码 匿名评论 发评论 以上网友发言只代表其个人观点,不代表新浪网的观点或立场。 < 前一篇闪电!! 后一篇 >在EditPlus里配置简单的各种程序开发调试平台 新浪BLOG意见反馈留言板 不良信息反馈 电话:4006900000 提示音后按1键(按当地市话标准计费) 欢迎批评指正 新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 会员注册 | 产品答疑 Copyright &copy; 1996 - 2014 SINA Corporation, All Rights Reserved 新浪公司 版权所有