先用ActiveX library建了一个project,然后用Automation建了一个Unit,这是建com的步骤,程序如下
unit Unit1;{$WARN SYMBOL_PLATFORM OFF}interfaceuses
  ComObj, ActiveX, testDll2_TLB, StdVcl, ASPTypeLibrary_TLB;type
  TTestObject = class(TAutoObject, ITestObject)
  protected
    procedure OnStartPage(const unk: IUnknown); safecall;
    procedure OnEndPage; safecall;
    procedure Test; safecall;
    procedure OpenDset; safecall;
    { Protected declarations }
  end;implementationuses ComServ, Unit2;var
  m_scriptContext : IscriptingContext;procedure TTestObject.OnStartPage(const unk: IUnknown);
begin
//      scriptContext
   m_scriptContext := unk as IscriptingContext;
end;procedure TTestObject.OnEndPage;
begin
    m_scriptContext := nil;
end;procedure TTestObject.Test;
begin
    m_scriptContext.Response.Write('ActiveX Test For Delphi');
end;procedure TTestObject.OpenDset;
begin
       Form2 := TForm2.Create(nil);
    try
       dSet1 :=Form2.OpenDataSet;
    finally
       Form2.Free;
    end;end;initialization
  TAutoObjectFactory.Create(ComServer, TTestObject, Class_TestObject,
    ciMultiInstance);end.
ASp的代码是
<%
       Set TestObject=Server.CreateObject("testDll2.TestObject")
       TestObject.TEST
       TestObject.OpenDset
       set TestObject=nothing
%>       
我已经注册了那个编译后DLL
在asp中执行test时可以,但当执行opendset时就出错,我后来重复试了几次, 发现是只要对数据库操作就不行, 它返回的错误是"必须加载一个DLL",究竟是为什么?