unit MasterDetail;

interface

uses
  Classes, SysUtils, IWAppForm, IWApplication, IWTypes, IWWebGrid,
  IWDBAdvWebGrid, DB, IWDBStdCtrls, Controls, IWBaseControl,
  IWControl, IWCompLabel, LeftFrame, Forms, TopFrame, IWVCLBaseControl,
  IWBaseHTMLControl, ADODB, Windows;

type
  TformMasterDetail = class(TIWAppForm)
    IWLabel1: TIWLabel;
    IWDBNavigator1: TIWDBNavigator;
    IWDBNavigator2: TIWDBNavigator;
    DataSource1: TDataSource;
    DataSource2: TDataSource;
    TIWDBAdvWebGrid1: TTIWDBAdvWebGrid;
    TIWDBAdvWebGrid2: TTIWDBAdvWebGrid;
    FrameTopFrame1: TFrameTopFrame;
    FrameLeftFrame1: TFrameLeftFrame;
    ADOConnection1: TADOConnection;
    ADOQuery1: TADOQuery;
    ADOQuery2: TADOQuery;
    procedure IWAppFormCreate(Sender: TObject);
    procedure IWDBNavigator1Next(Sender: TObject);
  public
  end;

implementation

{$R *.dfm}

uses
  ServerController;


procedure TformMasterDetail.IWAppFormCreate(Sender: TObject);
begin
  FrameTopFrame1.Align := alTop;
  FrameLeftFrame1.Align := alLeft;

  ADOConnection1.ConnectionString :=
    'Provider=Microsoft.Jet.OLEDB.4.0;Password="";Persist Security Info=True;Data Source= ' +
  WebApplication.ApplicationPath + 'demos.mdb';
  DataSource1.DataSet.Active := true;
  DataSource2.DataSet.Active := true;
end;

procedure TformMasterDetail.IWDBNavigator1Next(Sender: TObject);
begin

  ADOQuery2.Close;
//  ADOQuery2.SQL.Text := 'select * from orders where custno='+

  ADOQuery2.SQL.Text := 'SELECT orders.CustNo, orders.OrderNo, orders.EmpNo, orders.PO, customer.Company'
  + ' FROM customer INNER JOIN orders ON customer.CustNo = orders.CustNo'
  + ' WHERE (((orders.CustNo)=' +  IntToStr(ADOQuery1.FieldByName('CustNo').AsInteger) + '));'
 ;

  ADOQuery2.Open;
end;

initialization
  TformMasterDetail.SetAsMainForm



end.
