作为Delphi下非常好用的ReportBuilder,一定是程序员们比较爱使用的报表工具之一。只是不知道是Delphi程序员一定不会用Oracle呢,还是用ReportBuilder只是在自己的程序里提供报表,而不会提供报表工具,所以如果你使用过ReportBuilder的EnderUser例子的话,就会知道,在使用Oracle数据库(ADO方式)的情况下,问题很多,根本无法使用。
这个问题出在ReportBuilder身上,根本与你的程序无关。需要进行的修改如下:
daAdo.pas(这个怨Oracle)
ppRptExp.pas
ppTmplat.pas
为了尽量少修改源码,建议定义开关值后再进行修改。如:
{$IFDEF ENABLE_RB_ORA}
...
{$ENDIF}
准备工作:
Oracle中需要建立表,因为Oracle没有自增长类型,需要执行如下SQL语句:
CREATE TABLE "FOLDER" (
"FOLDERID" NUMBER(10) NOT NULL,
"NAME" VARCHAR2(60) NOT NULL,
"PARENTID" NUMBER(10) NOT NULL);
CREATE SEQUENCE "RBFOLDER" INCREMENT BY 1;
CREATE OR REPLACE TRIGGER "GEN_FOLDERID" BEFORE
INSERT ON "FOLDER"
FOR EACH ROW WHEN(NEW.FOLDERID IS NULL) BEGIN
SELECT "RBFOLDER".NEXTVAL INTO :NEW.FOLDERID FROM DUAL;
END;
CREATE TABLE "ITEM"(
"ITEMID" NUMBER(10) NOT NULL,
"SIZE0" NUMBER(10),
"FOLDERID" NUMBER(10) NOT NULL,
"NAME" VARCHAR2(60) NOT NULL,
"ITEMTYPE" NUMBER(10),
"MODIFIED" DATE,
"DELETED" CHAR(1) DEFAULT 'F',
"TEMPLATE" LONG RAW);
CREATE SEQUENCE "RBITEM" INCREMENT BY 1;
CREATE OR REPLACE TRIGGER "GEN_ITEMID" BEFORE
INSERT ON "ITEM"
FOR EACH ROW WHEN(NEW.ITEMID IS NULL) BEGIN
SELECT "RBITEM".NEXTVAL INTO :NEW.ITEMID FROM DUAL;
END;
CREATE TABLE "TABLE" (
"TABLENAME" VARCHAR2(60) NOT NULL,
"TABLEALIAS" VARCHAR2(60) NOT NULL);
CREATE TABLE "FIELD" (
"TABLENAME" VARCHAR2(60) NOT NULL,
"FIELDNAME" VARCHAR2(60) NOT NULL,
"FIELDALIAS" VARCHAR2(60) NOT NULL,
"SELECTABLE" CHAR(1) DEFAULT 'T',
"SEARCHABLE" CHAR(1) DEFAULT 'T',
"SORTABLE" CHAR(1) DEFAULT 'T',
"DATATYPE" VARCHAR2(60),
"AUTOSEARCH" CHAR(1) DEFAULT 'T',
"MANDATORY" CHAR(1) DEFAULT 'F');
CREATE TABLE RBJOIN (
TABLENAME1 VARCHAR2(60),
TABLENAME2 VARCHAR2(60),
JOINTYPE VARCHAR2(60),
FIELDNAMES1 VARCHAR2(255),
FIELDNAMES2 VARCHAR2(255),
OPERATORS VARCHAR2(60));
Delphi文件如下:http://www.miracube.com/downloads/rb7ora-patch-0.1.rar
(本文来源于图老师网站,更多请访问http://m.tulaoshi.com/bianchengyuyan/)