F
foxnt
Unregistered / Unconfirmed
GUEST, unregistred user!
用以下程序,不管我如何输,它总是recordcount=0,显示'用户名/密码不正确!'
但我肯定没输错。不知为何,请大虾指点!
另外请问,如果密码正确,我就想打开一个新web页,
向我下面这样就太麻烦了,请问有何良策?
unit myweb;
interface
uses
Windows, Messages, SysUtils, Classes, HTTPApp, DBTables, Db;
type
TWebModule1 = class(TWebModule)
Query_login: TQuery;
Database1: TDatabase;
procedure WebModule1WebloginAction(Sender: TObject;
Request: TWebRequest; Response: TWebResponse; var Handled: Boole
an);
private
{ Private declarations }
public
{ Public declarations }
end;
var
WebModule1: TWebModule1;
implementation
{$R *.DFM}
procedure TWebModule1.WebModule1WebloginAction(Sender: TObject;
Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
begin
Query_login.close;
Query_login.ParamByName('pusrname').asstring := trim(request.Content
Fields.Values['name']);
Query_login.ParamByName('pusrpw').asstring := trim(request.ContentFi
elds.Values['password']);
Query_login.open;
if Query_login.RecordCount<>0 then
Response.Content :='<html>'+
'<head>'+
'<meta http-equiv="Content-Type" content="text/html; cha
rset=gb2312">'+
'<meta name="GENERATOR" content="Microsoft FrontPage 3.0
">'+
'<title>开发大本营--Delphi系列I</title>'+
'</head>'+
'<body background="di2001.jpg">'+
'<div align="center"><center>'+
'<table border="0" width="100%" height="53">'+
'<tr>'+
'<td width="9%" height="40" valign="top" align="cent
er"></td>'+
'<td width="25%" height="40" valign="top" align="cen
ter"></td>'+
'<td width="10%" height="20" rowspan="7" valign="top
" align="center"></td>'+
'<td width="29%" height="1" rowspan="7" valign="top"
align="center"><a'+
'href="http://WWW.CSDN.NET" target="_blank"><img src
="base2.jpg"'+
'alt="开发大本营网站——WWW.CSDN.NET" width="454" he
ight="444" border="0"></a></td>'+
'<td width="7%" height="40" valign="top" align="cent
er"></td>'+
'</tr>'+
'<tr>'+
'<td width="9%" height="23"></td>'+
'<td width="25%" height="23" valign="top" align="cen
ter"><a href="DELPHI/index.htm"><img'+
'src="b2003.jpg" alt="Delphi 大本营" width="210" hei
ght="44" border="0"></a></td>'+
'<td width="7%" height="0"></td>'+
'</tr>'+
'<tr>'+
'<td width="9%" height="17"></td>'+
'<td width="25%" height="17" valign="top" align="cen
ter"><a href="DOC/index.htm"><img'+
'src="b2001.jpg" alt="文章精选" width="210" height="
45" border="0"></a></td>'+
'<td width="7%" height="17"></td>'+
'</tr>'+
'tr>'+
'<td width="9%" height="1"></td>'+
'<td width="25%" height="1" valign="top" align="cent
er"><a href="FORMAT/index.htm"><img'+
'src="b2002.jpg" alt="文件格式大全" width="211" heig
ht="45" border="0"></a></td>'+
'<td width="7%" height="1"></td>'+
'</tr>'+
'<tr>'+
'<td width="9%" height="1"></td>'+
'<td width="25%" height="1" valign="top" align="cent
er"><a href="WEB/index.htm"><img'+
'src="b2004.jpg" alt="技术站点" width="210" height="
45" border="0"></a></td>'+
'<td width="7%" height="1"></td>'+
'</tr>'+
'<tr>'+
'<td width="9%" height="1"></td>'+
'<td width="25%" height="1" valign="top" align="cent
er"><a href="JOKE/index.htm"><img'+
'src="b2005.jpg" alt="开心一刻" width="211" height="
45" border="0"></a></td>'+
'<td width="7%" height="1"></td>'+
'</tr>'+
'<tr>'+
'<td width="9%" height="1"></td>'+
'<td width="25%" height="1" align="center" valign="t
op"><a href="CO/index.htm"><img'+
'src="logo201.jpg" alt="编者的话" width="188" height
="107" border="0"></a></td>'+
'<td width="7%" height="1"></td>'+
'</tr>'+
'<tr>'+
'<td width="9%" height="48"></td>'+
'<td width="25%" height="48"></td>'+
'<td width="59%" height="48" colspan="2"></td>'+
'<td width="7%" height="48"></td>'+
'</tr>'+
'</table>'+
'</center></div>'+
'</body>'+
'</html>'
else if Query_login.RecordCount = 0 then
Response.Content := '用户名/密码不正确!'+'('+trim(request.ContentFi
elds.Values['name'])+')';
end;
end.