Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8862543
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T15:45:16+00:00 2026-06-14T15:45:16+00:00

I have a project which does financial reports and I want to let user

  • 0

I have a project which does financial reports and I want to let user to be able to get this reports through the internet

I tried using TIdHTTPServer which is an Indy component to make my application to work as an HTTP Server and to let it to be able

receive request -> process the request -> send back the result of the request process

using a special port.

now my problem is that I’m getting a lot of Access Violation errors and random exceptions
it looks like about threads problem or I don’t know because if I process the same request without using the TIdHTTPServer I don’t get any problem

i’m using the OnCommandGet Event to process the request and send the result back to user inside the context stream.

what I need is a demonstration on how to use it with TADODataSet and TADOConnection

for example I need the user to be able to send a request and the TIdHTTPServer takes the request (for example call a stored procedure using to ADODataSet and take the result as XML file and send it back to the user)

please help….thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T15:45:17+00:00Added an answer on June 14, 2026 at 3:45 pm

    one possibility how a Server could work …

    unit Unit3;
    
    interface
    
    uses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs,IDContext, IdBaseComponent, IdComponent, IdCustomTCPServer, IdTCPServer, StdCtrls, DB, ADODB;
    
    type
      TForm3 = class(TForm)
        IdTCPServer1: TIdTCPServer;
        Memo1: TMemo;
        Button1: TButton;
        DummyConnection: TADOConnection;
        procedure Button1Click(Sender: TObject);
        procedure IdTCPServer1Execute(AContext: TIdContext);
      private
        { Private-Deklarationen }
      public
        { Public-Deklarationen }
      end;
    
    var
      Form3: TForm3;
    
    implementation
    uses ComObj,AdoInt,ActiveX;
    {$R *.dfm}
    function SendStream(AContext: TIdContext; AStream: TStream): Boolean;
    begin
       Result := False;
       try
         AContext.Connection.IOHandler.Write(AStream.Size);  // sending length of Stream first
         AContext.Connection.IOHandler.WriteBufferOpen;
         AContext.Connection.IOHandler.Write(AStream, AStream.Size);
         AContext.Connection.IOHandler.WriteBufferFlush;
       finally
         AContext.Connection.IOHandler.WriteBufferClose;
       end;
       Result := True;
    end;
    
    procedure TForm3.Button1Click(Sender: TObject);
    begin
      IdTCPServer1.Active := true;
    end;
    
    
    { Clientside function
    Function RecordsetFromXMLStream(Stream:TStream): _Recordset;
    var
      RS: Variant;
    begin
        RS := CreateOleObject('ADODB.Recordset');
        RS.Open(TStreamAdapter.Create(Stream) as IUnknown);
        Result := IUnknown(RS) as _Recordset;
    end;
    }
    
    Procedure RecordsetToXMLStream(const Recordset: _Recordset;Stream:TStream);
    var
      RS: Variant;
    begin
        if Recordset = nil then Exit;
        RS := CreateOleObject('ADODB.Recordset');
        RS := Recordset;
        RS.Save(TStreamAdapter.Create(stream) as IUnknown, adPersistXML);
        Stream.Position := 0;
    end;
    
    Procedure GetQueryStream(Const s,ConStr:String;ms:TMemoryStream);
    var
     AC:TAdoConnection;
     ads:TAdodataset;
    begin
     AC:=TAdoConnection.Create(nil);
     try
     ads:=TAdodataset.Create(nil);
       try
         ads.Connection := AC;
         AC.ConnectionString := ConStr;
         ads.CommandText := s;
         ads.Open;
         RecordsetToXMLStream(ads.Recordset,ms);
       finally
         ads.Free
       end;
     finally
       AC.Free
     end;
    
    end;
    
    procedure TForm3.IdTCPServer1Execute(AContext: TIdContext);
    var
     cmd:String;
     ms:TMemoryStream;
    begin
         CoInitialize(nil);
         AContext.Connection.IOHandler.Readln(cmd);
         ms:=TMemoryStream.Create;
         try
         GetQueryStream('Select * from Adressen',DummyConnection.ConnectionString,ms);
         ms.Position := 0;
         SendStream(AContext,ms);
         AContext.Connection.Socket.CloseGracefully;
         finally
            ms.Free;
            CoUninitialize;
         end;
    
    end;
    end.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a project which uses strongly typed datasets. Let's assume I want to
I have project which includes external jar file in it, I followed this link
I have project in which I want to use check library for unit testing.
I have an iPhone project which currently does not have a UINavigationController in it.
I have a project which requires an image in the window. This is a
I have a project which does not follow the rails nameing conventions, because it
I have a GitHub project which does the same thing (a simple RogueLike game
I have an ASP project which references a WCF service. Does exactly half of
I have an old project which uses a 32 bit dll. This works fine
I have this C++ project which compiles using a Makefile, and sometimes when (

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.