S
scyshu
Unregistered / Unconfirmed
GUEST, unregistred user!
本人初学,每次运行到 vtables:=VARarraycreate([0,tblist.count-1],varvariant)
时出错,请指点!
unit Unit2;
{$WARN SYMBOL_PLATFORM OFF}
interface
uses
Windows, Messages, SysUtils, Classes, ComServ, ComObj, VCLCom, DataBkr,
DBClient, Project2_TLB, StdVcl, Provider, DB, ADODB;
type
Tserver223 = class(TRemoteDataModule, Iserver223)
ADOConnection1: TADOConnection;
ADOQuery1: TADOQuery;
DataSetProvider1: TDataSetProvider;
private
{ Private declarations }
protected
class procedure UpdateRegistry(Register: Boolean; const ClassID, ProgID: string); override;
procedure getalltables(var vtables: OleVariant); safecall;
public
{ Public declarations }
end;
implementation
{$R *.DFM}
class procedure Tserver223.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;
procedure Tserver223.getalltables(var vtables: OleVariant);
var
tblist:tstringlist;
icount:integer;
begin
try
tblist:=tstringlist.create;
adoconnection1.GetTableNames(tblist);
vtables:=VARarraycreate([0,tblist.count-1],varvariant);
for icount:=0 to tblist.count-1 do
BEGIN
vtables[icount]:=tblist.strings[icount];
end;
finally
tblist.free;
end;
end;
initialization
TComponentFactory.Create(ComServer, Tserver223,
Class_server223, ciMultiInstance, tmApartment);
end.
时出错,请指点!
unit Unit2;
{$WARN SYMBOL_PLATFORM OFF}
interface
uses
Windows, Messages, SysUtils, Classes, ComServ, ComObj, VCLCom, DataBkr,
DBClient, Project2_TLB, StdVcl, Provider, DB, ADODB;
type
Tserver223 = class(TRemoteDataModule, Iserver223)
ADOConnection1: TADOConnection;
ADOQuery1: TADOQuery;
DataSetProvider1: TDataSetProvider;
private
{ Private declarations }
protected
class procedure UpdateRegistry(Register: Boolean; const ClassID, ProgID: string); override;
procedure getalltables(var vtables: OleVariant); safecall;
public
{ Public declarations }
end;
implementation
{$R *.DFM}
class procedure Tserver223.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;
procedure Tserver223.getalltables(var vtables: OleVariant);
var
tblist:tstringlist;
icount:integer;
begin
try
tblist:=tstringlist.create;
adoconnection1.GetTableNames(tblist);
vtables:=VARarraycreate([0,tblist.count-1],varvariant);
for icount:=0 to tblist.count-1 do
BEGIN
vtables[icount]:=tblist.strings[icount];
end;
finally
tblist.free;
end;
end;
initialization
TComponentFactory.Create(ComServer, Tserver223,
Class_server223, ciMultiInstance, tmApartment);
end.