A
alcrow
Unregistered / Unconfirmed
GUEST, unregistred user!
应用服务器代码:
unit Unit2;
{$WARN SYMBOL_PLATFORM OFF}
interface
uses
Windows, Messages, SysUtils, Classes, ComServ, ComObj, VCLCom, DataBkr,
DBClient, Project1_TLB, StdVcl, Provider, DB, ADODB;
type
TLawyerServer = class(TRemoteDataModule, ILawyerServer)
ADOConnection1: TADOConnection;
ADOQuery1: TADOQuery;
DataSetProvider1: TDataSetProvider;
private
{ Private declarations }
protected
class procedure UpdateRegistry(Register: Boolean;
const ClassID, ProgID: string);
override;
public
{ Public declarations }
function num(): Integer;
end;
implementation
{$R *.DFM}
class procedure TLawyerServer.UpdateRegistry(Register: Boolean;
const ClassID, ProgID: string);
begin
if Register then
begin
inherited UpdateRegistry(Register, ClassID, ProgID);
EnableSocketTransport(ClassID);
EnableWebTransport(ClassID);
end else
begin
DisableSocketTransport(ClassID);
DisableWebTransport(ClassID);
inherited UpdateRegistry(Register, ClassID, ProgID);
end;
end;
function TLawyerServer.num(): Integer;
begin
result:=1;
end;
initialization
TComponentFactory.Create(ComServer, TLawyerServer,
Class_LawyerServer, ciMultiInstance, tmApartment);
end.
客户端程序:
unit Unit2;
interface
uses
SysUtils, Classes, DB, DBClient, MConnect, SConnect;
type
TDataModule2 = class(TDataModule)
DCOMConnection1: TDCOMConnection;
private
{ Private declarations }
public
{ Public declarations }
function num(): Integer;
end;
var
DataModule2: TDataModule2;
implementation
{$R *.dfm}
function TDataModule2.num(): Integer;
begin
result:=DCOMConnection1.AppServer.num;
end;
end.
TDataModule2.num()调用服务器端的num时报错:
Project Project1.exe raised exception class EOleError with message 'Method 'num' not supported by automation object'. Process stopped. Use Step or Run to continue.
请问是哪里出了问题了?谢谢
unit Unit2;
{$WARN SYMBOL_PLATFORM OFF}
interface
uses
Windows, Messages, SysUtils, Classes, ComServ, ComObj, VCLCom, DataBkr,
DBClient, Project1_TLB, StdVcl, Provider, DB, ADODB;
type
TLawyerServer = class(TRemoteDataModule, ILawyerServer)
ADOConnection1: TADOConnection;
ADOQuery1: TADOQuery;
DataSetProvider1: TDataSetProvider;
private
{ Private declarations }
protected
class procedure UpdateRegistry(Register: Boolean;
const ClassID, ProgID: string);
override;
public
{ Public declarations }
function num(): Integer;
end;
implementation
{$R *.DFM}
class procedure TLawyerServer.UpdateRegistry(Register: Boolean;
const ClassID, ProgID: string);
begin
if Register then
begin
inherited UpdateRegistry(Register, ClassID, ProgID);
EnableSocketTransport(ClassID);
EnableWebTransport(ClassID);
end else
begin
DisableSocketTransport(ClassID);
DisableWebTransport(ClassID);
inherited UpdateRegistry(Register, ClassID, ProgID);
end;
end;
function TLawyerServer.num(): Integer;
begin
result:=1;
end;
initialization
TComponentFactory.Create(ComServer, TLawyerServer,
Class_LawyerServer, ciMultiInstance, tmApartment);
end.
客户端程序:
unit Unit2;
interface
uses
SysUtils, Classes, DB, DBClient, MConnect, SConnect;
type
TDataModule2 = class(TDataModule)
DCOMConnection1: TDCOMConnection;
private
{ Private declarations }
public
{ Public declarations }
function num(): Integer;
end;
var
DataModule2: TDataModule2;
implementation
{$R *.dfm}
function TDataModule2.num(): Integer;
begin
result:=DCOMConnection1.AppServer.num;
end;
end.
TDataModule2.num()调用服务器端的num时报错:
Project Project1.exe raised exception class EOleError with message 'Method 'num' not supported by automation object'. Process stopped. Use Step or Run to continue.
请问是哪里出了问题了?谢谢