BarTender Activ eX 在Delphi 和VB 下调用数据库的实例(转贴) BarTender ActiveX 封装了大量的函数和属性,其中包括对数据库的调用
下面通过在Delphi 和VB 下的实例给出其调用方法
先看 Delphi 的例子
首先打开 BarTender 生成一个标签,并正确添加数据库,设置其子串共享名为domain1
打开 Delphi,创建一个工程
声明全局变量btapp,btformat,btdb
在FormCreate 过程中引用BarTender
btapp:=createoleobject('Bartender
application
7'); btapp
visible:=false; 5.向窗体中加入一个 button,设置其Caption 值为“打印”,其name 为“print”,为其click 过程添加代码: btformat:=btapp
formats
open('d:\bartender\format1
btw', true, ''); btdb:= btformat
databases
item(1); btformat
printout(0,0); btformat
close(1); 6
向 FormCloseQuery中加入代码: try btapp
quit(1) except application
terminate end; 7.保存并运行
源代码如下: uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, DB, OleCtrls, DBOleCtl, BA