home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2002 September
/
Chip_2002-09_cd1.bin
/
zkuste
/
delphi
/
kompon
/
d3456
/
SQLSET.ZIP
/
DEMO
/
MAIN.PAS
< prev
Wrap
Pascal/Delphi Source File
|
2001-02-12
|
1KB
|
64 lines
unit main;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
SqlSet, DBTables, StdCtrls, Grids, DBGrids, ExtCtrls, Db;
type
TMainForm = class(TForm)
SQLSet1: TSQLSet;
DataSource1: TDataSource;
Panel1: TPanel;
DBGrid1: TDBGrid;
ComboBox1: TComboBox;
Label1: TLabel;
Query1: TQuery;
procedure FormCreate(Sender: TObject);
procedure ComboBox1Change(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
MainForm: TMainForm;
implementation
{$R *.DFM}
procedure TMainForm.FormCreate(Sender: TObject);
begin
Query1.DataBaseName:=ExtractFilePath(ParamStr(0));
{Loading of countries in the ComboBox1}
ComboBox1.Items.Clear;
with Query1 do begin
SQL.Text:=SQLSet1.GetSQL('Countries');
Open;
First;
while not Eof do begin
ComboBox1.Items.Add(Fields[0].Value);
Next;
end;
Close;
end;
if ComboBox1.Items.Count>0 then ComboBox1.ItemIndex:=0;
DataSource1.DataSet:=Query1;
ComboBox1Change(Sender);
end;
procedure TMainForm.ComboBox1Change(Sender: TObject);
begin
{Featuring of the list of customers from selected country}
if SQLSet1.RegisterVar('CountryVar', ComboBox1.Text) then begin
Query1.SQL.Text:=SQLSet1.GetSQL('Customers');
Query1.Open;
end;
end;
end.