www.duketown.com

Home Delphi Page Hypertext of Delphi code Test HTML Send me an email Delphi Books

A Midas connection as a windows application


This example contains a small Midas Client for console usage. For complete usage you'll need the simple Midas Server example.
To use this so called thin client you'll need the simple Midas Server example. The MidasConnection.ConnectType property in this example is set to ctSockets, which means that at the side of the Midas Server the SocketServer must be started. This program (scktsrvr.exe) is located in the Delphi\BIN directory. If you want to use DCOM then simple change this property to ctDCOM.

Further more you'll need to have the DBClient.dll file installed further described in Building a Midas server step by step guide.



View the project source (.DPR)
View the unit source (.PAS)
Download the complete code (.ZIP)

Generated with HyperDelphi

program Client;

uses
  Forms,
  Unit1 in 'Unit1.pas' {Form1};

{$R *.RES}

begin
  Application.Initialize;
  Application.CreateForm(TForm1, Form1);
  Application.Run;
end.

Goto Top


Generated with HyperDelphi

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  DBClient, MIDASCon, Db, StdCtrls, Grids, DBGrids;

type
  TForm1 = class(TForm)
    ClientDataSet1: TClientDataSet;
    MIDASConnection1: TMIDASConnection;
    Button1: TButton;
    DataSource1: TDataSource;
    DBGrid1: TDBGrid;
    Edit1: TEdit;
    Label1: TLabel;
    Button2: TButton;
    Button3: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
begin
  Clientdataset1.Data := Clientdataset1.Provider.DataRequest(Edit1.Text);
  Clientdataset1.Open;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  MidasConnection1.Connected:=False;
end;

procedure TForm1.Button3Click(Sender: TObject);
begin
  MidasConnection1.Connected:=True;
end;

end.

Goto Top