小弟用D6编写一个基于ISAPI的Web Server Application的查询数据库程序. 缺省的动作事件,其代码如下:
procedure TWebModule1.WebModule1WebActionItem1Action(Sender: TObject;
  Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
var
  Count: Integer;
  Input: TStrings;
begin
  Input := nil;
  case request.methodtype of
    mtpost:
      Input := request.ContentFields;
    mtget, mtput, mthead:
      Input := request.QueryFields;
  end;  if input.values['username'] <> '' then
  begin
    Response.content :=
      '<HTML><HEAD><TITLE>查询结果</TITLE></HEAD>'#13 +
      '<BODY>'#13 +
      '<H2><font face="隶书" color="green">查询结果信息: </font></H2 > '#13 +
      '<tableborder=1>'#13 +
      '<tr>'#13 +
      '<th>座号</th>'#13 +
      '<th>姓名</th>'#13 +
      '<th>出生日期</th>'#13 +
      '<th>身份证号码</th>'#13 +
      '<tr>'#13; //#13是换行符    ADOQuery1.Active := false;
    ADOQuery1.sql.clear;
    ADOQuery1.sql.add('select * from students ' +
      'where 姓名 like "%' + input.values['username'] + '%"');
    
    ADOQuery1.Active := True;
    ADOQuery1.first;    
    ADOQuery1.Active := True;
    Count := 0;
    while not ADOQuery1.eof do
    begin
      response.content := response.content + '<tr>'#13 +
        '<td>' + ADOQuery1.Fields[0].AsString + '</td>'#13 +
        '<td>' + ADOQuery1.Fields[1].AsString + '</td>'#13 +
        '<td>' + ADOQuery1.Fields[2].AsString + '</td>'#13 +
        '<td>' + ADOQuery1.Fields[3].AsString + '</td>'#13 +
        '<tr>'#13;
      count := count + 1;
      ADOQuery1.Next;
    end;   // Count := 10;
    response.content := response.content +
      '共查询到' + inttostr(count) + '条信息<br>';
    response.content := response.content + '</table> </BODY> </HTML> ';
    //ADOQuery1.Close;
  end
  else
    response.content := '请先输入标题关键词:';
end; 提交username域的index.htm 的 内 容 如 下: <HTML><HEAD><TITLE>学生信息查询</TITLE>
</HEAD>
<BODY>
<h1>学生信息查询卡</h1>
<HR>
<FORM action="http://127.0.0.1/testdll/webqrydb.dll" method=post>
请输入学生姓名关键词:<input type="text" size="16" Maxlength="16" name="username"><BR>
<INPUT TYPE=SUBMIT VALUE="查询">
<INPUT TYPE=RESET VALUE="重填">
</FORM>
<HR>
</BODY></HTML>当我按'查询'按钮后,总是返回"HTTP 500 - 内部服务器错误",如果我把有关访问数据库的语句屏蔽,访问正常!因此我怀疑是不是有关访问数据库的语句的语句出错,我把有关访问数据库编译成普通的应用程序,又正常,不知哪里出错,请各位高手不吝指教!多谢了