大致上可以是这样一个结构,使用automation object
unit Example;
{$WARN SYMBOL_PLATFORM OFF}
interface
uses
ComObj, ActiveX, PM_TLB, StdVcl, ADODB;
type
TExample = class(TAutoObject, IExample)
private
FConnection: TADOConnection;
protected
procedure Test; safecall;
public
procedure Initialize; override;
destructor Destroy; override;
{ Protected declarations }
end;
implementation
uses ComServ;
const
sConnectionStr: string = 'Provider=Microsoft.Jet.OLEDB.4.0;Password="";Data Source=E:/Work/PM/root/data/Project.mdb;Persist Security Info=True';
destructor TExample.Destroy;
begin
inherited;
FConnection.Free;
end;
procedure TExample.Initialize;
begin
inherited;
FConnection := TADOConnection.Create(nil);
FConnection.ConnectionString := sConnectionStr;
FConnection.CursorLocation := clUseServer;
FConnection.LoginPrompt := False;
FConnection.Connected := True;
end;
procedure TExample.Test;
begin
FConnection.Execute('update....');
end;
initialization
TAutoObjectFactory.Create(ComServer, TExample, Class_Example,
ciMultiInstance, tmApartment);
end.
我这里的工程名是pm,asp就能这样调用
set o = server.createobject("pm.example")
o.test;
set o = nothing