下面很长,希望您仔细看,不管您解决是否,我想通过大家的讨论你总能学些东西,不管你说的对不对,希望你把知道的都说出来,谢谢,我调了一天了,实在不行了,
1、新建一个 ActiveX Library -名称为:Soft
2、再建一个 Active Server Object -名称为:TodayTop(TodayTop10.pas)
3、再建一个 Data Module
4、在 Data Module 中放入一个 ADOConnection 连接数据库,成功。再放入一个ADOQuery,设置它的Connection为ADOConnection
5、然后在TodayTop中加入一个GetTop10的方法
6、这是TodayTop的代码
//------------------------------------------------------------------------------unit TodayTopPas;
//------------------------------------------------------------------------------{$WARN SYMBOL_PLATFORM OFF}
//------------------------------------------------------------------------------interface//------------------------------------------------------------------------------uses
ComObj, ActiveX, AspTlb, soft_TLB, StdVcl, DM1, SysUtils;
//------------------------------------------------------------------------------
type
TTodayTop = class(TASPObject, ITodayTop)
private
FDM:TDM;
protected
procedure OnEndPage; safecall;
procedure OnStartPage(const AScriptingContext: IUnknown); safecall;
procedure GetTop10; safecall;
public
procedure Initialize;override;
destructor Destroy;override;
end;
//------------------------------------------------------------------------------implementation
//------------------------------------------------------------------------------uses ComServ, Forms;
//------------------------------------------------------------------------------//加载数据模块
procedure TTodayTop.Initialize;
begin
inherited;
FDM:=TDM.Create(Forms.Application);
end;
//------------------------------------------------------------------------------//释放数据模块
destructor TTodayTop.Destroy;
begin
inherited;
FDM.Free;
end;
//------------------------------------------------------------------------------procedure TTodayTop.OnEndPage;
begin
inherited OnEndPage;
end;
//------------------------------------------------------------------------------procedure TTodayTop.OnStartPage(const AScriptingContext: IUnknown);
begin
inherited OnStartPage(AScriptingContext);
end;
//------------------------------------------------------------------------------procedure TTodayTop.GetTop10;
var
TodayDate:String;
begin
TodayDate:=DateToStr(Date);
With DM.ADOQuery1 do
begin
{Close;
Sql.Clear;
Sql.Add('select top 10 id,showname,bb from download '+
'where lasthits='''+TodayDate+''' and stop=0 and '+
'dayhits>0 order by dayhits desc');
Open; Response.Write('<table width="99%" border="1">');
Response.Write('<tr>');
if(Eof and Bof)then
begin
Response.Write('<td>');
Response.Write('本日没有下载');
Response.Write('</td>');
end
else
begin
While not Eof do
begin
Response.Write('<td>');
Response.Write('<li><A href=list.asp?id='''+FieldByname('id').Value+'''>');
Response.Write(FieldByname('ShowName').Value+' '+FieldByname('bb').Value);
Response.Write('</A></li>');
Response.Write('</td>');
Next;
end;
end;
Response.Write('</tr>');
Response.Write('</table>');}
end;
end;
//------------------------------------------------------------------------------initialization
TAutoObjectFactory.Create(ComServer, TTodayTop, Class_TodayTop,
ciMultiInstance, tmApartment);
//------------------------------------------------------------------------------end.//------------------------------------------------------------------------------7、编译生成 Soft.dll 文件
8、在 TodayTopAsp.asp 中调用这个对象,如下:
//------------------------------------------------------------------------------
<%@language=Jscript%>
<HTML>
<BODY>
<TITLE> Testing Delphi ASP </TITLE>
<CENTER>
<H3> You should see the results of your Delphi Active Server method below </H3>
</CENTER>
<HR>
<%
var DelphiASPObj;
DelphiASPObj = Server.CreateObject("soft.TodayTop");
DelphiASPObj.GetTop10();%>
<HR>
</BODY>
</HTML>
//------------------------------------------------------------------------------9、用iis搭建服务器,访问出现错误 500.100请大家仔细看看,帮我查查原因,非常感谢
1、新建一个 ActiveX Library -名称为:Soft
2、再建一个 Active Server Object -名称为:TodayTop(TodayTop10.pas)
3、再建一个 Data Module
4、在 Data Module 中放入一个 ADOConnection 连接数据库,成功。再放入一个ADOQuery,设置它的Connection为ADOConnection
5、然后在TodayTop中加入一个GetTop10的方法
6、这是TodayTop的代码
//------------------------------------------------------------------------------unit TodayTopPas;
//------------------------------------------------------------------------------{$WARN SYMBOL_PLATFORM OFF}
//------------------------------------------------------------------------------interface//------------------------------------------------------------------------------uses
ComObj, ActiveX, AspTlb, soft_TLB, StdVcl, DM1, SysUtils;
//------------------------------------------------------------------------------
type
TTodayTop = class(TASPObject, ITodayTop)
private
FDM:TDM;
protected
procedure OnEndPage; safecall;
procedure OnStartPage(const AScriptingContext: IUnknown); safecall;
procedure GetTop10; safecall;
public
procedure Initialize;override;
destructor Destroy;override;
end;
//------------------------------------------------------------------------------implementation
//------------------------------------------------------------------------------uses ComServ, Forms;
//------------------------------------------------------------------------------//加载数据模块
procedure TTodayTop.Initialize;
begin
inherited;
FDM:=TDM.Create(Forms.Application);
end;
//------------------------------------------------------------------------------//释放数据模块
destructor TTodayTop.Destroy;
begin
inherited;
FDM.Free;
end;
//------------------------------------------------------------------------------procedure TTodayTop.OnEndPage;
begin
inherited OnEndPage;
end;
//------------------------------------------------------------------------------procedure TTodayTop.OnStartPage(const AScriptingContext: IUnknown);
begin
inherited OnStartPage(AScriptingContext);
end;
//------------------------------------------------------------------------------procedure TTodayTop.GetTop10;
var
TodayDate:String;
begin
TodayDate:=DateToStr(Date);
With DM.ADOQuery1 do
begin
{Close;
Sql.Clear;
Sql.Add('select top 10 id,showname,bb from download '+
'where lasthits='''+TodayDate+''' and stop=0 and '+
'dayhits>0 order by dayhits desc');
Open; Response.Write('<table width="99%" border="1">');
Response.Write('<tr>');
if(Eof and Bof)then
begin
Response.Write('<td>');
Response.Write('本日没有下载');
Response.Write('</td>');
end
else
begin
While not Eof do
begin
Response.Write('<td>');
Response.Write('<li><A href=list.asp?id='''+FieldByname('id').Value+'''>');
Response.Write(FieldByname('ShowName').Value+' '+FieldByname('bb').Value);
Response.Write('</A></li>');
Response.Write('</td>');
Next;
end;
end;
Response.Write('</tr>');
Response.Write('</table>');}
end;
end;
//------------------------------------------------------------------------------initialization
TAutoObjectFactory.Create(ComServer, TTodayTop, Class_TodayTop,
ciMultiInstance, tmApartment);
//------------------------------------------------------------------------------end.//------------------------------------------------------------------------------7、编译生成 Soft.dll 文件
8、在 TodayTopAsp.asp 中调用这个对象,如下:
//------------------------------------------------------------------------------
<%@language=Jscript%>
<HTML>
<BODY>
<TITLE> Testing Delphi ASP </TITLE>
<CENTER>
<H3> You should see the results of your Delphi Active Server method below </H3>
</CENTER>
<HR>
<%
var DelphiASPObj;
DelphiASPObj = Server.CreateObject("soft.TodayTop");
DelphiASPObj.GetTop10();%>
<HR>
</BODY>
</HTML>
//------------------------------------------------------------------------------9、用iis搭建服务器,访问出现错误 500.100请大家仔细看看,帮我查查原因,非常感谢
解决方案 »
- 如何用delphi操作Excel查找所有包含特定字符串的数据?
- 枚举类型变量的值如何输出
- 在delphi中调用c api的一个类型转换问题([char ***] to [delphi type])
- 升星,散分!(自己很不好意思,其实我是水星)
- ***10张图片,循环显示,如何实现象powerpoint中的幻灯片切换那样的效果(比如百叶窗,淡入淡出等)?***
- 在delphi 中 ProgressBar1进度随我的变量改变,该如何控制
- 在Writeln()之前,怎样判断文件是否已打开并处于可写状态?
- 大家一定要帮我这个帮忙
- 請 fisheep_cn(笨鱼) 來領分! 多謝。
- 到底有没有人在WIN98下成功地配置过DCOM?
- Pascal中泡沫法是怎樣寫法,能否舉個例子?相關的還有其它什麼法嗎?如遞歸?我對Pascal不熟。特此請教
- 求一些三层分布式开发的资料用于写毕业论文?UP有分!
你的Soft.dll有可能没注册,你注册试试。命令提示符上键入:regsvr32 Soft.dll .