asp组件问题(15分)

  • 主题发起人 主题发起人 sunmico
  • 开始时间 开始时间
S

sunmico

Unregistered / Unconfirmed
GUEST, unregistred user!
unit showname;

{$WARN SYMBOL_PLATFORM OFF}

interface

uses
ComObj, ActiveX, AspTlb, name_TLB, StdVcl, dm;

type
Tshowname = class(TASPMTSObject, Ishowname)
private
tempDM : TdmPersonal;
protected
procedure send_my_name(out myname: OleVariant); safecall;
procedure send_name_list; safecall;
public
procedure Initialize; override;
destructor Destroy; override;
end;

implementation

uses ComServ, Forms;

destructor Tshowname.Destroy;
begin
inherited;
tempDM.Free;
end;

procedure Tshowname.Initialize;
begin
inherited;
tempDM.Create(Forms.Application);
end;

procedure Tshowname.send_my_name(out myname: OleVariant);
begin
myname := 'Hello,World!!';
end;

procedure Tshowname.send_name_list;
var tmpString : String;
begin
tmpString:='';
with tempDM do
begin
while not adoDataSet.Eof do
begin
tmpString := tmpString+'<tr><td>'+adoDataSet.FieldByName('equipment').AsString+'</td></tr>';
adoDataSet.Next;
end;
end;
Response.Write(tmpString);
end;

initialization
TAutoObjectFactory.Create(ComServer, Tshowname, Class_showname,
ciMultiInstance, tmApartment);
end.

dm为DataModule,里面只有一个TADODATASET对象,这里Showname为COM+的CoClassName,
在重载Initialize和destory中加入DM的初始化和关闭工作,DataSet的Open和Close则放
在DM的Create和Destory中。该组件创建成功,可是ASP调用时无法得到结果,结果是类似
于死循环一样的症状。请问各位,何解?

抱歉只有15分了
 
后退
顶部