Subject ISAPI DLL under Win2k?
Author Denis Sarrazin
I recently downloaded the latest IBO and I've successfully converted an
existing complex Delphi 5 application to use it instead of the BDE. Very nice
and easy and works well (at first glance -- we'll be doing more tests).

On my second attempt, I tried to convert an ISAPI DLL project but that doesn't
seem to want to work on my machine.

To try to isolate the problem, I created a new ISAPI DLL project, dropped a
TIB_Session component, a TIB_Connection component and a TIB_Cursor component (I
had also tried with a TIBODatabase and TIBOQuery components). I set the
username and password of the TIB_Connection, and assigned it the proper alias
and gave it a DatabaseName. I then entered a simple SQL statement in the
TIB_Cursor (or TIBOQuery) and I opened it in the editor. No problem. I closed
it.

I then created a default web action in my TWebModule. This action calls a
method which opens the TIB_Cursor and goes through it adding the content of one
of the field to the Response.Content string and returns this.

Unfortunatly, on both my conversion of my existing working ISAPI DLL and this
small test program, I get the same error: HTTP 500 - Internal server error.

To verify things further, I created another ISAPI DLL, did the same stuff as
above but using the BDE equivalent (ie TSession, TDatabase and TQuery) and the
thing works fine.

Note that both DLLs are stored in the same directory which is enabled to run
web scripts and executables so I know that the IIS side of things is properly
setup (I've been using it for a while doing various kinds of DLLs and things
work quite well).

What am I missing? Is there something else that needs to be done for ISAPI DLLs
to be able to use IBO?

My current setup is as follows: Delphi 5 Enterprise (patch 1 applied), Windows
2000 with IIS 5 (which comes with it), 256 MB RAM, Pentium III 667, IBO 3.6.Be.

Here is the code for my web action:

function TrimQuotes(s: string): string;
begin

if (Length(s) > 2) and (s[1] = '<') then
Result := Copy(s,2,Length(s)-2)
else
Result := s;

end;

procedure TWebModule1.WebModule1waiTest(Sender: TObject;
Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
var
sResponse: string;
begin

sResponse := '<html><head><title>Test1 - IBO</title></head>'+
'<body><h1>Test1 - IBO</h1><p>';

IBOQuery1.Open;
IBOQuery1.First;
while not IBOQuery1.Eof do
begin
sResponse := sResponse +
TrimQuotes(IBOQuery1.FieldByName('SYSTEM_HTML_TAG').AsString) + '<p>';
IBOQuery1.Next;
end;
IBOQuery1.Close;

sResponse := sResponse + '</body></html>';

Response.Content := sResponse;
Handled := true;

end;

Thanks,
Denis