章名
·
1
·
PowerBuilder 9.0
实用教程
北
京
主编
樊金生 张翠肖
沙 金 贾玉锋
PowerBuilder 8.0
实用教程
·
2
·
责任编辑:赵卫江/责任校对:都
岚
责任印制:吕春珉/封面设计:王 浩
科学出版社
出版
北京东黄城根北街
16
号
邮政编码:
100717
http://www.sciencep.com
双青印刷厂印刷
科学出版社总发行 各地新华书店经销
*
2004 年 6 月第 一 版 开本:787×1092 1/16
2006 年 7 月第三次印刷 印张:22 01/2/92 1/16
印数:8 001-11 000
字数:513 00092 1/16
定价:30.00 元
(如有印装质量问题,我社负责调换<环伟>)
内 容 简 介
本书系统描述了
PowerBuilder 9.0
版的组成以及它们的语言、事
件和函数,对构成 PowerBuilder 的各种对象(应用、窗口、控件、菜
单、数据窗口、用户对象)以及它们的创建和使用方法等内容做了详
细讲解,演示了如何用 InstallShield 制作安装盘,并介绍了数据管道、
动态数据窗口、拖放技术、
API
技术、分布式应用和
Web
应用等高级
技术,最后一章针对
PowerBuilder
的主要技术给出了一个完整的实
例。每章后面附有习题,便于学生练习。
本书可作为大专院校学生的教材和教学参考书,也可供各种培训
班使用和应用开发人员参考。
图书在版编目(CIP)数据
PowerBuilder 9.0
实用教程
/
樊金生等主编
.—
北京:科学出版社,
2004.6
ISBN 7-03-013418-4
I . P
…
II .
樊…
III .
数据库系统-软件工具,
PowerBuilder 9.0
-高等
学校-教材
IV. TP311.56
中国版本图书馆
CIP
数据核字(
2004
)第
045473
号
章名
·
3
·
前
言
1999
年我们编写了《
PowerBuilder 6.5
实用教程》,该书荣获铁道部第四届优秀教材
二等奖。2003 年又出版了《
PowerBuilder 8.0
实用教程》,该书已多次重印,深受读者好
评。应广大读者的要求,我们又编写了《PowerBuilder 9.0 实用教程》,本书吸取了前两
版的精髓,完善了不足。
在当今信息时代,数据处理技术已深入到我们工作和生活的方方面面,而数据库技
术是数据处理不可缺少的手段。随着数据库技术的发展,面向对象的数据库、分布式数
据库、多媒体数据库、数据库开发工具的研究方兴未艾。
PowerBuilder
是一种快速构建
商业应用程序的面向对象的开发工具,
IDC
将之称为一种“黄金标准”,即一个用于衡量
所有应用开发工具的基准。它集面向对象数据库技术、分布式应用技术、多媒体技术于
一身,是目前最有代表性的数据库开发工具,它占有全球客户/服务器前端开发工具市
场 40%的份额,位居第一,几乎已发展成为客户/服务器前端开发工具的标准。由 Sybase
公司的独资子公司
PowerSoft
公司
2003
年推出的
PowerBuilder 9.0
堪称迄今最成功的数
据库应用系统的辅助开发工具,它新增了对
J2EE
和
Microsoft.Net
开发环境的支持功能,
其面向对象的开发方法,
Internet/Intranet
和分布式应用能力,与当前流行的大型数据库
和微机数据库的接口等诸多优点,使它一经推出就受到广大应用开发人员的青睐。作为
一个面向对象的、手段丰富的开发环境,它能极大地提高程序员的工作效率,加快应用
系统的开发速度。随着 PowerBuilder 的日益普及,希望了解和掌握它的人越来越多,在
大学的很多专业也已开设有关课程介绍
PowerBuilder
。本书正是应这种要求而写的,它
按教材的体系、教学的特点来介绍
PowerBuilder
,力求通俗易懂、由浅入深、循序渐进,
并在每章后面附有习题,便于学生练习和掌握所学内容。本书除详细介绍
PowerBuilder
的基本内容,如应用、窗口、菜单、数据窗口、数据库、事件、函数、用户对象外,还
介绍了数据管道、动态数据窗口、拖放技术、API 技术、分布式应用和 Web 应用等高级
技术。通过本书的学习,不仅能达到入门的目的,还能掌握应用系统的实际开发能力,
自己开发出实用、高效的应用系统。本书可作为大专院校学生的教材和教学参考书,也
可供各种培训班使用和应用开发人员参考。
本书由樊金生、张翠肖、沙金、贾玉锋主编,邸书灵、朴春慧、刘展威、毛晚堆、
张国兵、胡迎新、高志伟也参加了编写工作。其中,第一、二、三章由沙金和樊金生编
写,第四、五、六章由张翠肖和张国兵编写,第七、八章由邸书灵和贾玉锋编写,第十
章由沙金和朴春慧编写,第九章由樊金生和胡迎新编写,第十一章由沙金和贾玉锋编写,
第十二章由贾玉锋、邸书灵、朴春慧和高志伟编写,第十三章由张翠肖和刘展威编写,
第十四章由沙金和毛晚堆编写,全书由樊金生统稿。在本书编写过程中,参考了许多同
行的著作,在此一并表示感谢。
由于作者水平所限,错误和不当之处在所难免,敬请读者批评指正。
作
者
2004 年 4 月 1 日
目 录
第一章 PowerBuilder 9.0 概述············································································ 1
§1.1 PowerBuilder 9.0 简介 ··············································································· 1
§1.1.1 PowerBuilder 的优异功能和特点 ·········································································· 1
§1.1.2 PowerBuilder 9.0 的新特性····················································································
2
§1.2 PowerBuilder 9.0 的开发环境···································································· 4
§
1.2.1 PowerBuilder
工具栏的组成
··················································································
5
§
1.2.2 PowerBuilder
的画板
·····························································································
6
§
1.2.3 PowerBuilder
菜单栏的组成
················································································
11
§
1.3 PowerBuilder 9.0
应用系统的构成
·····································································12
§1.3.1 工作空间和目标 ··································································································
12
§
1.3.2
窗口、控件、事件和程序
···················································································
13
§
1.3.3
函数
······················································································································
13
§1.4 本书的应用实例······································································································13
习题 ··········································································································································17
第二章
数据库
·································································································· 18
§
2.1
数据库的建立
·························································································· 19
§
2.1.1
创建本地的
Adaptive Server Anywhere
数据库
···················································
19
§
2.1.2
创建表
··················································································································
20
§
2.2 PowerBuilder
与各种数据库的连接
························································ 21
§2.2.1 通过 ODBC 接口连接··························································································21
§
2.2.2
通过专用接口连接
·······························································································
23
§
2.2.3
改变连接的数据库
·······························································································
24
§2.3 操作数据库表 ·························································································· 24
§
2.3.1
打开、关闭和删除表
···························································································
24
§2.3.2 修改表和列的属性·······························································································
25
§2.3.3 修改表的定义 ······································································································
27
§
2.3.4
建立索引
··············································································································
28
§
2.3.5
建立主键和外部键
·······························································································
28
§2.3.6 数据库操作日志 ··································································································
30
§2.4 视图操作·································································································· 30
§
2.4.1
创建和删除视图
··································································································
31
§
2.4.2
查看视图的
SQL
语法
·························································································
32
§
2.4.3
表或视图语法的输出
···························································································
32
PowerBuilder 9.0
实用教程
·
iv
·
§
2.5
数据操作
·································································································· 32
§
2.5.1
数据检索
··············································································································
33
§
2.5.2
数据修改
··············································································································
33
§
2.5.3
数据排序和过滤
··································································································
34
§2.5.4 大量数据的录入 ··································································································
35
§2.5.5 数据打印 ··············································································································
35
§2.6 数据库的管理 ·························································································· 35
§
2.6.1
数据库存取控制
··································································································
36
§2.6.2 执行 SQL 语句·····································································································
37
§2.6.3 数据库的备份与恢复···························································································
38
习题
··········································································································································39
第三章
应用对象
······································································································ 40
§3.1 概述 ········································································································· 40
§3.2 创建新的应用对象 ·················································································· 41
§
3.3
指定应用对象的属性
··············································································· 43
§
3.4
编写应用级的程序
·················································································· 47
§
3.4.1
编程环境
··············································································································
47
§
3.4.2
事件处理程序
······································································································
50
习题 ····················································································································· 51
第四章 窗口及窗口上的控件············································································· 52
§
4.1
窗口的组成及类型
·················································································· 52
§
4.2
创建窗口
·································································································· 53
§
4.2.1
窗口工作区
··········································································································
54
§
4.2.2
定义窗口的属性
··································································································
55
§4.2.3 在窗口上放置控件·······························································································
58
§4.2.4 窗口的保存 ··········································································································
58
§
4.2.5
查看定义好的窗口
·······························································································
59
§
4.2.6
窗口对象的编程
··································································································
60
§4.3 窗口上放置的控件 ·················································································· 60
§
4.3.1
在窗口上放置控件
·······························································································
61
§4.3.2 设置控件的属性 ··································································································
61
§4.3.3 窗口上控件的调整·······························································································
65
§
4.3.4
控件的编程
··········································································································
66
§4.4 控件的使用······························································································ 66
§
4.4.1
激活动作类型(按钮类型)
···············································································
66
§
4.4.2
列出选择项类型
··································································································
68
§4.4.3 文本显示和编辑控件···························································································
69
§4.4.4 列表选择 ··············································································································
73
§
4.4.5
图片控件
··············································································································
76
评论7