//=======接口单元========================
type
iPrinter = interface(IInterface)
['{8DFEE989-FBE2-4015-9F8B-B045494035EB}']
function Design(const AFrmID:String; const MasDtSet,DtlDtSet:TADODataSet): Boolean;
end;
//=======DLL 中对象单元============================
type
TiPrinter = class(TInterfacedObject,iPrinter)
private
protected
public
constructor Create;
destructor Destroy; override;
function Design(const AFrmID:String; const MasDtSet,DtlDtSet:TADODataSet): Boolean;
end;
function TiPrinter.Design(const AFrmID: String; const MasDtSet,
DtlDtSet: TADODataSet): Boolean;
begin
frm_PubSoft.OpenSQL('Select Report from FR where FormID='''+AfrmID+''' and Used=1');
if MasDtSet<>nil then
frm_PubSoft.frMstDataSet.DataSet:=MasDtSet;
if DtlDtSet<>nil then
frm_PubSoft.frDtlDataSet.DataSet:=DtlDtSet;
frm_PubSoft.frReport.LoadFromBlobField(frm_PubSoft.SQLQuery.FieldByName('Report'));
frm_PubSoft.frReport.DesignReport;
end;
DLL输出
function FPrint: iPrinter; stdcall;
begin
result:=TiPrinter.Create;
end;
//=======Form 使用===
function FPrint: Main_Printer; stdcall; external 'SoftReg.dll' name 'FPrint';
var
MyPrint: iPrinter;
begin
MyPrint:=FPrint;
MyPrint.Design('Other03',ADODataSet1,ADODataSet2);
MyPrint:=nil;
//======结果=====================================
程序运行正常
但 传入的 ADODataSet1,ADODataSet2 没有字段(类似于DataSet没有激活)
已经搞了我好几天了,好晕.大家帮忙看看,有没有什么好办法来解决Fr的封装?
type
iPrinter = interface(IInterface)
['{8DFEE989-FBE2-4015-9F8B-B045494035EB}']
function Design(const AFrmID:String; const MasDtSet,DtlDtSet:TADODataSet): Boolean;
end;
//=======DLL 中对象单元============================
type
TiPrinter = class(TInterfacedObject,iPrinter)
private
protected
public
constructor Create;
destructor Destroy; override;
function Design(const AFrmID:String; const MasDtSet,DtlDtSet:TADODataSet): Boolean;
end;
function TiPrinter.Design(const AFrmID: String; const MasDtSet,
DtlDtSet: TADODataSet): Boolean;
begin
frm_PubSoft.OpenSQL('Select Report from FR where FormID='''+AfrmID+''' and Used=1');
if MasDtSet<>nil then
frm_PubSoft.frMstDataSet.DataSet:=MasDtSet;
if DtlDtSet<>nil then
frm_PubSoft.frDtlDataSet.DataSet:=DtlDtSet;
frm_PubSoft.frReport.LoadFromBlobField(frm_PubSoft.SQLQuery.FieldByName('Report'));
frm_PubSoft.frReport.DesignReport;
end;
DLL输出
function FPrint: iPrinter; stdcall;
begin
result:=TiPrinter.Create;
end;
//=======Form 使用===
function FPrint: Main_Printer; stdcall; external 'SoftReg.dll' name 'FPrint';
var
MyPrint: iPrinter;
begin
MyPrint:=FPrint;
MyPrint.Design('Other03',ADODataSet1,ADODataSet2);
MyPrint:=nil;
//======结果=====================================
程序运行正常
但 传入的 ADODataSet1,ADODataSet2 没有字段(类似于DataSet没有激活)
已经搞了我好几天了,好晕.大家帮忙看看,有没有什么好办法来解决Fr的封装?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货