Database 版 (精华区)

发信人: joy ( 雨送黄昏花易落), 信区: Database
标  题: pfc举例
发信站: 紫 丁 香 (Sun Jul 26 08:59:10 1998), 转信


    d:\hj\technical\pb\pfc\pfc.pbl
    C:\Pwrs\Pb5i32\Adk\pfc\PFCAPSRV.PBL;
    C:\Pwrs\Pb5i32\Adk\pfc\PFCDWARV.PBL;
    C:\Pwrs\Pb5i32\Adk\pfc\PFMAIN.PBL;
    C:\Pwrs\Pb5i32\Adk\pfc\PFCWNSRV.PBL;
    C:\Pwrs\Pb5i32\Adk\pfc\PFEAPSRV.PBL;
    C:\Pwrs\Pb5i32\Adk\pfc\PFEDWARV.PBL;
    C:\Pwrs\Pb5i32\Adk\pfc\PFEMAIN.PBL;
    C:\Pwrs\Pb5i32\Adk\pfc\PFEWNSRV.PBL;
    保存应用对象(有些目录可根据用户机器目录而定)。
    2.在应用对象的Variable Types属性中,将SQLCA的类型改为n_tr
,并保存应用对象o DB V5'
    Prompt=0
    AutoCommit=0

    3.从位于pfcapsrv.pbl中的n_cst_appmanager用户对象上继承一
个新对象。在对象的c onstructor事件中填写如下代码:
    if SQLCA.of_Init("pfc.ini","Profile Powersoft Demo DB V5
") = -1 then
    MessageBox('SQLCA Error', "Can not initialize the transa
ction!")
    Halt Close
    end if
    Connect Using SQLCA;
    在对象的pfc_open事件中填写如下代码:
  //Open(w_3dw)
    将这个对象命名为nu_app,并保存起来。

    4.进入应用对象的open事件中,声明全局变量nu_app gnv_app,然
后填写如下代码:
    gnv_app = Create nu_app
    gnv_app.Event pfc_Open(commandline)
    在应用对象的close事件中填写如下代码:
    gnv_app.Event Pfc_Close()
    Disconnect Using SQLCA;
    Destroy gnv_app

    5.创建一个窗口,其中数据窗口对象的定
    义分别为:
    d_customers:
      SELECT "customer"."id",
      "customer"."company_name"
      FROM "customer"
    d_salesorder:
      SELECT "sales_order"."id",
      "sales_order"."cust_id",
      "sales_order"."order_date",
      "sales_order"."sales_rep"
      FROM "sales_order"
      WHERE "sales_order"."cust_id" = :argcust_id
    其中argcust_id是retrieval argument。
    d_orderitems:
     SELECT "sales_order_items"."id",
        "sales_order_items"."line_id",
        "sales_order_items"."prod_id",
        "sales_order_items"."quantity",
        "sales_order_items"."ship_date"
     FROM "sales_order_items"
     WHERE "sales_order_items"."id" = :argorder_id
    其中argorder_id是Retrieval argument。

    6.在dw_one的constructor事件中填写如下代码:
        of_SetLinkAge(True)
        This.SetRowFocusIndicator(Hand!)
    在pfc_retrieve事件中填写:Return this.Retrieve()
    在dw_two constructor事件中填写如下代码:
       of_SetLinkage(True)
       dw_two.inv_Linkage.of_LinkTo(dw_one)
       dw_two.inv_Linkage.of_SetArguments(id','cust_id')
       dw_two.inv_LinkAge.of_SetUseColLinks(2)
       this.SetRowFocusIndicator(focusRect!)
    在dw_three constructor事件中填写如下代码:
        of_SetLinkAge(True)
        inv_LinkAge.of_LinkTo(dw_two)
        inv_LinkAge.of_SetArguments('id','id')
        inv_LinkAge.of_SetUseColLinks(2)
    在窗口的open事件中填写如下代码:
        dw_one.inv_LinkAge.of_SetTransObject(SQLCA)
        dw_one.inv_LinkAge.of_Retrieve()
    在Update按钮的click事件中填写如下代码:
        Parent.Event pfc_Save()

    7.保存窗口,并且命名为w_3dw。打开3中open(w_3dw)的注释。
    8.运行这个程序。
    这时会看到三个数据窗口在级连地动作,当按下鼠标右键时会弹
出可以更新数据窗口的菜单,按下Update按钮会更新数据库。
    这是一个非常简单的PFC例子,具体这些代码的含义我们会在以后
的文章中详细介绍

--
※ 来源:.紫 丁 香 bbs.hit.edu.cn.[FROM: 202.118.229.129]
[百宝箱] [返回首页] [上级目录] [根目录] [返回顶部] [刷新] [返回]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:3.650毫秒