PB8 程序设计培训讲义.docx

上传人:b****4 文档编号:3635813 上传时间:2022-11-24 格式:DOCX 页数:49 大小:1.22MB
下载 相关 举报
PB8 程序设计培训讲义.docx_第1页
第1页 / 共49页
PB8 程序设计培训讲义.docx_第2页
第2页 / 共49页
PB8 程序设计培训讲义.docx_第3页
第3页 / 共49页
PB8 程序设计培训讲义.docx_第4页
第4页 / 共49页
PB8 程序设计培训讲义.docx_第5页
第5页 / 共49页
点击查看更多>>
下载资源
资源描述

PB8 程序设计培训讲义.docx

《PB8 程序设计培训讲义.docx》由会员分享,可在线阅读,更多相关《PB8 程序设计培训讲义.docx(49页珍藏版)》请在冰豆网上搜索。

PB8 程序设计培训讲义.docx

PB8程序设计培训讲义

PB8程序设计培训课程

 

注意:

本培训讲义中所用的特殊符号含义如下。

要点实例

配置步骤&

选学内容

第一章PB8集成开发环境介绍

一、PB8与现行开发工具对比

开发效率(MIS)多层构架界面制作适用范围

PB很高很高一般数据库

VB一般一般较好一般

DELPHI一般一般最好最广

二、PB8开发工具的发展历程

PB6每次只能开发一个应用,不能同时修改代码与界面

PB7每次只能开发一个应用,可以同时修改代码与界面

PB8每次可以开发多个应用,可以同时修改代码与界面

三、PB8的特点

1.初学有障碍,入门后进境迅速

2.界面较单一,需用心制作界面

3.完全的面向对象

4.基于事件驱动的程序设计

5.开放的数据库系统

6.多平台的支持

7.支持团队开发,集成的源代码控制系统

8.支持多层应用程序组件的部署

9.简洁的模块复用技术

四、PB8新增的功能

1.功能强大的系统树

2.灵巧的输出窗口

3.深得人心的剪贴窗口

4.方便的WEB开发,集成了PowerSite站点开发工具

5.优雅的源代码编辑器

6.整合的组件服务器

7.新的数据库驱动接口

8.新增的系统函数

9.新增的错误捕获技术

五、PB8的IDE环境

1.新增[new]的使用

2.继承[inherit]的使用

3.打开[open]的使用

4.预览[preview]的使用

5.系统树[systemtree]的使用

6.输入窗口[output]的使用

7.错误消息切换[errormessage]的使用

8.任务列表[to-dolist]的使用

9.浏览窗口[browse]的应用

10.剪贴窗口[clipwindow]的使用

11.库画板画板[library]的使用

12.数据库配置文件[dbprofile]的使用

13.服务器配置文件[easerverprofile]的使用

14.数据库画板[database]的使用

15.多功能编辑器[edit]的使用

16.部署应用程序[deploy]的使用

17.调试[debug]的使用

18.运行[run]的使用

六、PB8做MIS系统的流程

1.不得不做的需求分析(用户手册)

2.系统设计方法(概要设计、详细设计、操作手册)

3.数据库设计方法

4.程序设计方法及注意事项

5.软件测试及试运行

6.后期维护与二次开发

七、PB8开发应用程序的步骤

1.创建一个工作区(*.pbw)NEW>WORKSPACE

2.创建一个目标文件(*.pbt),规划库列表(*.pbl),设置全局属性

3.创建数据库配置文件(*.ini)

4.设置事务属性、连接数据库、测试连接是否成功

5.创建主菜单、为菜单指定工具条图标

6.创建主窗口(TYPE:

mdihelp),关联主菜单到主窗口(主窗口不充许放置控件)

7.创建工作窗口(TYPE:

main),在主菜单中打开

8.布置控件到工作窗口、

9.生成数据窗口对象,将它与工作窗口的数据窗口控件关联

10.为工作窗口的事件编写代码(OPEN)

11.为工作窗口的控件编写代码

八、PB8创建菜单的方法

1.创建子菜单(submenu)

2.添加菜单

3.插入菜单

4.编辑菜单

5.复制生成菜单

6.删除菜单

九、PB8创建工具栏的方法

1.为对应菜单指定工具条图标

2.为对应菜单指定工具条提示

3.为对应菜单指定工具条次序

4.为对应菜单指定工具条索引

十、PB8应用对象、菜单对象详解

1.应用对象属性、事件、函数及附加属性

AppNameString

ClassDefinitionPowerObject

DDETimeOutInteger

DisplayNameString

DWMessageTitleString

FreeDBLibrariesBoolean

MicroHelpDefaultString

RightToLeftBoolean

ToolbarFrameTitleString

ToolbarPopMenuTextString

ToolbarSheetTitleString

ToolbarTextBoolean

ToolbarTipsBoolean

ToolbarUserControlBoolean

CloseWhentheuserclosestheapplication.

ConnectionBeginObsolete(usedfordistributedPowerBuilderconnections)

ConnectionEndObsolete(usedfordistributedPowerBuilderconnections)

Idle由空闲函数触发

OpenWhentheuserrunstheapplication.

SystemErrorWhenaseriousexecutiontimeerroroccurs

ClassNameStringReturnstheclassoftheApplicationobject.

GetContextServiceInteger

PostEventBoolean

SetLibraryListIntegerSetsthePBDlibrarylistinanexecutable.

SetTransPoolInteger

TriggerEventInteger

TypeOfObject(iftypeof(this)=application!

Thenendif)

2.菜单对象属性、事件、函数

CheckedBoolean

ClassDefinitionPowerObject

DefaultBoolean(是否加黑)

EnabledBoolean

Item[]MenuSpecifiestheMenuobjectsunderaMenuobject.

MenuItemTypeMenuItemType

MergeOptionMenuMergeMicroHelpStringSpecifiesthetextoftheMicroHelpfortheobject.

ParentWindowWindowSpecifiesthewindowthatownstheMenuobject.

ShiftToRightBoolean(在继承菜单中指定菜单项的位置)

ShortcutInteger

TagStringSpecifiesthetagvalueassignedtotheMenuobject.

TextStringSpecifiesthetextintheMenuobject.

ToolbarItemDownBoolean.

ToolbarItemDownNameString

ToolbarItemBarIndexInteger

ToolbarItemNameString

ToolbarItemOrderIntegerSpecifiestheorderoftheiteminthetoolbar.

ToolbarItemSpaceInteger

ToolbarItemTextString

ToolbarItemVisibleBoolean

ClickedWhentheMenuobjectisclicked(selectedorunselected).

HelpWhentheuserpressestheF1keyordragsthecontexthelpbutton

SelectedWhentheusermovestotheMenuobjectusingthearrowkeysorthemouse.

CheckInteger

ClassNameStringReturnstheclassoftheMenuobject.

DisableInteger

EnableInteger

GetContextServiceInteger

GetParentPowerObject(getparent().classname()如果是菜单,返回上级菜单)

HideIntegerMakestheMenuobjectinvisible.

PopMenuIntegerDisplaystheMenuobjectatthespecifiedlocation.

PostEventInteger

ShowIntegerMakestheMenuobjectvisible.

TriggerEventInteger

TypeOfObjectReturnsthetypeofthecontrol.

UncheckInteger

3.一个PB应用实例

第二章PB8的数据库管理功能

一、如何使用ODBC连接数据库

创建数据源、创建ODBC配置文件(ACCESS、SQL、ORACLE)DBPROFILE

二、如何使用专用接口连接数据库

创建专用接口的配置文件(SQL、ORACLE)

三、如何使用OLEDB接口连接数据库

创建OLEDB接口的配置文件(SQL、ORACLE)

四、事务对象与事务控制语句(SQLCA)

1、事务对象的属性、事件、函数

2、常用的事务控制语句

五、常用的SQL语句

1、DML语句

SELECT、INSERT、DELETE、UPDATE

2、DCL语句

GRANT、REVOKE

3、DDL语句

CREATEDATABASE、CREATETABLE、CREATEVIEW、CREATEDEFAULT

CREATERULE、CREATEINDEX

ALTERDATABASE、ALTERTABLE、ALTERVIEW、ALTERDEFAULT

ALTERRULE、ALTERINDEX

DROPDATABASE、DROPTABLE、DROPVIEW、DROPDEFAULT

DROPRULE、DROPINDEX

4、高级SQL选项

GROUPBY、ORDERBY、DISTINCT、UNION

5、常用SQL聚合函数

SUM()、MAX()、MIN()、COUNT()、AVG()

6、常用SQL函数

GETDATE()、CONVERT()、CAST()

六、使用数据库画板创建数据库对象、数据管道的使用

1、创建、修改与删除表、视图

2、创建角色、登录帐号、用户

3、创建主键、外键、索引及其作用

4、创建与使用数据管道导入数据

5、数据库画板中不得不注意的事项(恢复原来布局)

七、创建存储过程、函数、触发器与游标

CREATEPROCEDURE、CREATEFUNCTION

CREATETRIGGER、DECLARECURSOR

ALTERPROCEDURE、ALTERFUNCTION、ALTERTRIGGER

DROPPROCEDURE、DROPFUNCTION、DROPTRIGGER

八、配置文件的生成与用法

1、生成配置文件

2、使用配置文件

3、使用注册表项

九、接对象的创建与用法

创建与使用连接对象(声明实例对象)

十、动态SQL的四种语法格式(help:

Dynamic)

1、没有输入与输出参数的SQL

2、有输入参数没有输出参数的SQL

3、有输入参数输出参数的SQL

4、未知的返回结果集类型的SQL

5、PB自带的系统表用法

6、上机练习作业:

按下图所示、制作出“商品类别录入”窗口与“商品单位录入”窗口

第三章PB8语言及其系统函数

一、PowerScript语言的数据类型

Blob(图像)IntegerorInt2^16(2*8)

BooleanLong2^32(4*8)

Charorcharacter(单个字符)Real

DateString

DateTimeTime

DecimalorDecUnsignedInteger,UnsignedInt,orUIntdecimal{3}ld_price

DoubleUnsignedLongorULong

二、PowerScript语言的运算符

1、算术运算符

+、-、*、/、^(2^3=8)

2、关系运算符

=、>、<、>=、<=、<>

3、连接运算符  +‘a’+’b’=’ab’

4、续行运算符&两行或多行做为一行来执行

5、逻辑运算符AND、OR、NOT

6、特殊运算符适用于SQL语句

IS、LIKE、NOTLIKE、BEWTEEN…AND、IN、NOTIN

三、PowerScript语言的注释

1、行注释//intli_msg=1

2、块注释/*intli_msg=1*/

3、注释的作用

四、常量、变量、数组的定义与使用

1、常量的定义与使用(CONSTANTintMIN=1000)常量不允许修改

2、变量的定义与使用数据类型变量名intli_max

3、数组的定义与使用数据类型数组名[n,m]intli_demo[]intli_demo1[2to10]

4、标识符的声明规范(变量与对象)

五、PowerScript语言的系统函数

1.数组函数

LowerBoundThelowerboundofdimensionnofaspecifiedarray.

UpperBoundTheupperboundofdimensionnofaspecifiedarray.

2.BLOB函数

BlobConvertorcopydatatoablobdatatype

BlobEditCopydataintoavariablestartingatagivenposition

BlobMidObtaincharactersinblobdatastartingatcharactern.

LenObtainthelengthofablob

StringConvertablobtoastring

3.数据类型转换函数

AscObtaintheASCIIvalueofacharacter.

CharObtainablob,integer,orstringasachar.

Dec把一个(数字)字符串转换为一个DEC类型的数dec(‘123.45’)=123.45

DoubleObtainthecontentsofastringasadouble.

IntegerObtainthecontentsofastringasaninteger.

LongObtainthecontentsofastringasalong.

RealObtainthecontentsofastringasareal.

DateObtainthedateportionofaDateTimevalue

DateTimeObtainadateandatimeasaDateTimevalue.

IsDateDeterminewhetherthespecifiedstringcontainsavaliddate

IsNullDeterminewhethertheargumentisNULL.

IsNumberDeterminewhetherthespecifiedstringcontainsanumber.

IsTimeDeterminewhetherthespecifiedstringcontainsavalidtime.

StringObtainadatetoastringformattedinaspecifiedformat

TimeObtainthetimeportionofaDateTimevalue

4.日期时间函数

DayTheday(anintegerbetween1and31)

DayNameThenameofthedayoftheweek

DayNumberforexample,Sundayis1andWednesdayis4

DaysAfterThenumberofdaysonedateoccursafteranother

HourThetimefromwhichyouwanttoobtainthehour

MinuteThetimefromwhichyouwanttoobtaintheminutes

MonthThemonth(anintegerbetween1and12)

Now系统时间

RelativeDateThedatethatoccursndaysafteragivendate

RelativeTimeThetimethatoccursnsecondsafteragiventime.

SecondThenumberofsecondsinthesecondsportionofagiventime.

SecondsAfterThenumberofsecondsonetimeoccursafteranother.

Today系统日期

YearTheyear(anintegerbetween1000and3000)

5.目录文件函数

FileClose(3)Closeafile

FileCopyCopyafile

FileDeleteDeleteafile

FileExistsDeterminewhetherafileexists

FileLengthObtainthelengthofafile

FileMoveMoveafile

FileOpen

(1)Openafile

FileRead

(2)Readafile

FileSeekSeektoapositioninafile

FileWrite

(2)Writetoafile.

ChangeDirectoryChangedirectory

CreateDirectoryCreateadirectory

DirectoryExistsDetermineifanameddirectoryexists

GetCurrentDirectoryGetthenameofthecurrentdirectory

GetFileOpenNameDisplayOpenFiledialog.

GetFileSaveNameDisplaySaveFiledialog.

RemoveDirectoryRemoveadirectory

6.数值函数

AbsObtaintheabsolutevalueofanumber.

ASinObtainthearcsineofanangle.Theangleisinradians.

ACosObtainthearccosineofanangle.Theangleisinradians.

ATanObtainthearctangentofanangle.Theangleisinradians.

Ceiling返回大于给定值的最小整数ceiling(3.2)=4

CosObtainthecosineofanangle.Theangleisinradians.

ExpObtaineraisedtothepowerofx.

FactObtainthefactorialofx.

Int返回小于给定值的最大整数int(3.2)=3

LogObtainthenaturallogarithm(basee)ofanumber.

LogTenObtainthedecimallogarithm(base10)ofanumber.

MaxObtainthelargeroftwonumbers.

MinObtainthesmalleroftwonumbers.

ModObtainthemodulusoftwonumbers(forexample:

mod(1,2)=1)余数

PiObtainpi(3.14159265358979323)timesanumber.

RandObtainarandomwholenumber(between1andaspecifiednumber).Rand(10)

RandomizeInitializetherandomnumbergenerator.

RoundObtainanumberroundedtoanumberofdecimalplaces.

SignObtainanumber(-1,0,or1)indicatingthesignofanumber.

SinObtainthesineofanangle.Theangleisinradians.

SqrtObtainthesquarerootofanumber.

TanObtainthetangentofanangle.Theangleis

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 求职职场 > 简历

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1