delphi数据库编程实例 BarTender ActiveX 在Delphi和VB下调用数据库的实例.doc
文本预览下载声明
delphi数据库编程实例 BarTender ActiveX 在Delphi和VB下调用数据库的实例
导读:就爱阅读网友为您分享以下“BarTender ActiveX 在Delphi和VB下调用数据库的实例”的资讯,希望对您有所帮助,感谢您对92的支持!
BarTender ActiveX 在Delphi和VB下调用数据库的实例(转贴)
BarTender ActiveX封装了大量的函数和属性,其中包括对数据库的调用。下面通过在Delphi和VB下的实例给出其调用方法。
先看Delphi的例子。
1. 首先打开BarTender生成一个标签,并正确添加数据库,设置其子串共享名为domain1。
2. 打开Delphi,创建一个工程。
3. 声明全局变量btapp,btformat,btdb。
4. 在FormCreate过程中引用BarTender。
btapp:=createoleobject(#39;Bartender.application.7#39;);
btapp.visible:=false;
5.向窗体中加入一个button,设置其Caption值为“打印”,其name为“print”,为其click过程添加代码:
btformat:=btapp.formats.open(#39;d:\bartender\format1.btw#39;, true, #39;#39;);
btdb:= btformat.databases.item(1);
btformat.printout(0,0);
btformat.close(1);
6. 向FormCloseQuery中加入代码: try btapp.quit(1) except application.terminate end;
7.保存并运行。
源代码如下:
uses
显示全部