新
新小丸子
Unregistered / Unconfirmed
GUEST, unregistred user!
组件单元如下:[]
unit asp_database_main;
interface
uses
ComObj, ActiveX, AspTlb, asp_database_project_TLB, StdVcl, SysUtils,DBTables;
type
Tasp_database = class(TASPObject, Iasp_database)
protected
procedure OnEndPage; safecall;
procedure OnStartPage(const AScriptingContext: IUnknown); safecall;
procedure findarticle; safecall;
end;
implementation
uses ComServ;
procedure Tasp_database.OnEndPage;
begin
inherited OnEndPage;
end;
procedure Tasp_database.OnStartPage(const AScriptingContext: IUnknown);
begin
inherited OnStartPage(AScriptingContext);
end;
procedure Tasp_database.findarticle;
var
myquery:TQuery;
thetitle:string;
begin
myquery:= TQuery.Create(nil);
myquery.databasename:='news';
thetitle:=request.form.item['thetitle'];
with myquery do
begin
close;
with sql do
begin
clear;
add('select * from jxoption');
add(' where title like :title');
end;
parambyname('title').asstring:='%'+thetitle+'%';
if not prepared then
prepare;
try
open;
except
execsql;
end;
end;
if not myquery.eof then
begin
response.write('<center><font color=red size=3>'+myquery['title']+'</font></center>');
response.write('<right>'+myquery['cdate']+' '+myquery['sourse']+'</right>');
response.write('<p>'+myquery['content']+'</p>');
end
else
response.write('没有这篇文章!!!');
myquery.free;
end;
initialization
TAutoObjectFactory.Create(ComServer, Tasp_database, Class_asp_database,
ciMultiInstance, tmApartment);
end.
功能很简单,就是从页面表单里获得要查询的标题的关键字,然后去数据库里查询后返回信息。
asp程序如下:
<%@language=jscript%>
<HTML>
<BODY>
<TITLE>查询返回</TITLE>
<CENTER>
<H3> 哈哈,文章显示出来没??? </H3>
</CENTER>
<HR>
<%
var DelphiASPObj;
DelphiASPObj = Server.CreateObject("asp_database_project.asp_database");
DelphiASPObj.findarticle;//就这行抱错
%>
<HR>
</BODY>
</HTML>
抱错是:对象不支持此属性或方法
/delphi/asp_database_asppage.asp,行12
麻烦各位帮我看看好么?我非常渴望,万分感谢了!
unit asp_database_main;
interface
uses
ComObj, ActiveX, AspTlb, asp_database_project_TLB, StdVcl, SysUtils,DBTables;
type
Tasp_database = class(TASPObject, Iasp_database)
protected
procedure OnEndPage; safecall;
procedure OnStartPage(const AScriptingContext: IUnknown); safecall;
procedure findarticle; safecall;
end;
implementation
uses ComServ;
procedure Tasp_database.OnEndPage;
begin
inherited OnEndPage;
end;
procedure Tasp_database.OnStartPage(const AScriptingContext: IUnknown);
begin
inherited OnStartPage(AScriptingContext);
end;
procedure Tasp_database.findarticle;
var
myquery:TQuery;
thetitle:string;
begin
myquery:= TQuery.Create(nil);
myquery.databasename:='news';
thetitle:=request.form.item['thetitle'];
with myquery do
begin
close;
with sql do
begin
clear;
add('select * from jxoption');
add(' where title like :title');
end;
parambyname('title').asstring:='%'+thetitle+'%';
if not prepared then
prepare;
try
open;
except
execsql;
end;
end;
if not myquery.eof then
begin
response.write('<center><font color=red size=3>'+myquery['title']+'</font></center>');
response.write('<right>'+myquery['cdate']+' '+myquery['sourse']+'</right>');
response.write('<p>'+myquery['content']+'</p>');
end
else
response.write('没有这篇文章!!!');
myquery.free;
end;
initialization
TAutoObjectFactory.Create(ComServer, Tasp_database, Class_asp_database,
ciMultiInstance, tmApartment);
end.
功能很简单,就是从页面表单里获得要查询的标题的关键字,然后去数据库里查询后返回信息。
asp程序如下:
<%@language=jscript%>
<HTML>
<BODY>
<TITLE>查询返回</TITLE>
<CENTER>
<H3> 哈哈,文章显示出来没??? </H3>
</CENTER>
<HR>
<%
var DelphiASPObj;
DelphiASPObj = Server.CreateObject("asp_database_project.asp_database");
DelphiASPObj.findarticle;//就这行抱错
%>
<HR>
</BODY>
</HTML>
抱错是:对象不支持此属性或方法
/delphi/asp_database_asppage.asp,行12
麻烦各位帮我看看好么?我非常渴望,万分感谢了!