首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > .NET >

在Remote data module模块中能使用Constructor(构造函数)吗?解决思路

2012-03-03 
在Remote data module模块中能使用Constructor(构造函数)吗?代码如下:unit RDM{$WARN SYMBOL_PLATFORM OF

在Remote data module模块中能使用Constructor(构造函数)吗?
代码如下:
unit RDM;

{$WARN SYMBOL_PLATFORM OFF}

interface

uses
  Windows, Messages, SysUtils, Classes, ComServ, ComObj, VCLCom, DataBkr,
  DBClient, GP50Server_TLB, StdVcl, DBTables, Provider, DB;

type
  TGP50RDM = class(TRemoteDataModule, IGP50RDM)
  ...
  private
  { Private declarations }
  protected
  class procedure UpdateRegistry(Register: Boolean; const ClassID, ProgID: string); override;
  public
  { Public declarations }
//第一种:按照系统的原型或不带参数:
//编译时[Error] RDM.pas(205): Declaration of 'Create' differs from previous declaration //好像说的意思是:"说明与先前的说明不同" 
Constructor Create(ComServer:TComServerObject;CompentClass:TComponentClass;Const ClassID:TGUID;Instancing:TClassInstancing;ThreadingModel:TThreadingModel); override;
Constructor Create();override;
//第二种:
//编译时:[Error] Main.pas(16): Unsatisfied forward or external declaration: 'TForm1.create'//好像说的意思是:"不满足的向前或外部说明" 
constructor create(TOwner:TComponent);override;

  end;

...
implementation

{$R *.DFM}

....
initialization
//--定义的原型:--加入Remote date module时,系统自动创建的,只不过我把它贴出来

{
TComponentFactory.Create:proceduce
(ComServer:TComServerObject;CompentClass:TComponentClass;
Const ClassID:TGUID;Instancing:TClassInstancing;ThreadingModel:TThreadingModel=tmSingle);
}
//--加入Remote date module时,系统自动创建的
  TComponentFactory.Create(ComServer, TGP50RDM,
  Class_GP50RDM, ciMultiInstance, tmApartment);
end.

说明:我想要的结果是调用Remote data module模块时.通过构造器来实现读取ini配置文件.ini文件中存有数据库登陆名和密码.
不知道这样子实现有没有问题,或者是有更好的方法,请各位指点指点...


[解决办法]
行不行试试不就知道了

热点排行