D
djiang
Unregistered / Unconfirmed
GUEST, unregistred user!
我看过以前的帖子,实做了一个例子,但有错误:
谁能帮我指出一下错误,或给我一个例子!
我的代码:
unit Test2U;
{$WARN SYMBOL_PLATFORM OFF}
interface
uses
ComObj, ActiveX, AspTlb, test2_TLB, StdVcl,ADODb,ADOdb_TLB, Db;
type
TMyTest = class(TASPObject, IMyTest)
private
fRecordSet:ADOdb_TLB._RecordSet;
protected
procedure OnEndPage;
safecall;
procedure OnStartPage(const AScriptingContext: IUnknown);
safecall;
function Get_P1: _Recordset;
safecall;
procedure myset;
safecall;
end;
implementation
uses ComServ, dmU;
procedure TMyTest.OnEndPage;
begin
inherited OnEndPage;
end;
procedure TMyTest.OnStartPage(const AScriptingContext: IUnknown);
begin
inherited OnStartPage(AScriptingContext);
end;
function TMyTest.Get_P1: _Recordset;
begin
Result:=fRecordset;
end;
procedure TMyTest.myset;
var ADOQuery1:TADOQuery;
begin
ADOQuery1:=TADOQuery.Create(nil);
ADOQuery1.Connection := DM.ADOConnection1 ;
ADOQuery1.SQL.Text := 'Select Top 100 * From I_Info_2050';
ADOQuery1.Open ;
fRecordSet:=ADODB_TLB._RecordSet(ADOQuery1.Recordset);
end;
initialization
TAutoObjectFactory.Create(ComServer, TMyTest, Class_MyTest,
ciMultiInstance, tmApartment);
end.
调用时:
<% Set DelphiASPObj = Server.CreateObject("test2.MyTest")
DelphiASPObj.myset()
%>
发生错误:
--------------------------------
错误 '8000ffff'
灾难性故障
/test2/mytest.asp,行9
--------------------------------
谁能帮我指出一下错误,或给我一个例子!
我的代码:
unit Test2U;
{$WARN SYMBOL_PLATFORM OFF}
interface
uses
ComObj, ActiveX, AspTlb, test2_TLB, StdVcl,ADODb,ADOdb_TLB, Db;
type
TMyTest = class(TASPObject, IMyTest)
private
fRecordSet:ADOdb_TLB._RecordSet;
protected
procedure OnEndPage;
safecall;
procedure OnStartPage(const AScriptingContext: IUnknown);
safecall;
function Get_P1: _Recordset;
safecall;
procedure myset;
safecall;
end;
implementation
uses ComServ, dmU;
procedure TMyTest.OnEndPage;
begin
inherited OnEndPage;
end;
procedure TMyTest.OnStartPage(const AScriptingContext: IUnknown);
begin
inherited OnStartPage(AScriptingContext);
end;
function TMyTest.Get_P1: _Recordset;
begin
Result:=fRecordset;
end;
procedure TMyTest.myset;
var ADOQuery1:TADOQuery;
begin
ADOQuery1:=TADOQuery.Create(nil);
ADOQuery1.Connection := DM.ADOConnection1 ;
ADOQuery1.SQL.Text := 'Select Top 100 * From I_Info_2050';
ADOQuery1.Open ;
fRecordSet:=ADODB_TLB._RecordSet(ADOQuery1.Recordset);
end;
initialization
TAutoObjectFactory.Create(ComServer, TMyTest, Class_MyTest,
ciMultiInstance, tmApartment);
end.
调用时:
<% Set DelphiASPObj = Server.CreateObject("test2.MyTest")
DelphiASPObj.myset()
%>
发生错误:
--------------------------------
错误 '8000ffff'
灾难性故障
/test2/mytest.asp,行9
--------------------------------