![]() |
|
|
|||||||
| Регистрация | << Правила форума >> | FAQ | Пользователи | Календарь | Поиск | Сообщения за сегодня | Все разделы прочитаны |
![]() |
|
|
Опции темы | Поиск в этой теме | Опции просмотра |
|
#1
|
|||
|
|||
|
Код:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DBCtrls, DB, DBTables, Grids, DBGrids, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Query2: TQuery;
ComboBox1: TComboBox;
DataSource1: TDataSource;
Query1: TQuery;
Label1: TLabel;
DBGrid1: TDBGrid;
DBGrid2: TDBGrid;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var str:string;
begin
query2. SQL. Clear;
query2. SQL. Add('Select*from paradox7Table.db');
query2. Open;
query2.first;
ComboBox1.Clear;
While not Query2. Eof do
begin
str:=Query2.fieldBYname('DepName').AsString;
ComboBox1.Items.Add(str);
query2.Next;
end;
ComboBox1.Items.Add('');
ComboBox1.ItemIndex:=ComboBox1.Items.Count-1;
Query1.Close;
Query1.SQL.Clear;
Query1.SQL.Add('Select*from Person');
Query1.Open;
end;
begin
Query1.Close;
Query1.SQL.Clear;
Query1.SQL.Add ('Select*from Person');
if ComboBox1.ItemIndex<combobox1.Items.Count-1 then;
begin
Query1.SQL.Add('where DepId=:pDepID');
Query2.Locate('DepName',combobox1.Text,[]);
CurId:=Query2.FieldByName('DepID').AsInteger;
Query1.Params[0].AsInteger:=CurID;
end;
Query1.Open;
end;
end.Последний раз редактировалось Ilshat, 20.01.2010 в 13:38. |
|
#2
|
||||
|
||||
|
Код:
if ComboBox1.ItemIndex<combobox1.Items.Count-1 then; |
|
#3
|
|||
|
|||
|
он у меня находит ошибку в этой части-Query1.Close;
end; begin Query1.Close; Query1.SQL.Clear; Query1.SQL.Add ('Select*from Person'); if ComboBox1.ItemIndex<combobox1.Items.Count-1 then begin |
|
#4
|
||||
|
||||
|
Код:
ComboBox1.ItemIndex:=ComboBox1.Items.Count-1;
Query1.Close;
Query1.SQL.Clear;
Query1.SQL.Add('Select*from Person');
Query1.Open;Код:
end; begin Код:
Query1.Close;
Query1.SQL.Clear;
Query1.SQL.Add ('Select*from Person');
if ComboBox1.ItemIndex<combobox1.Items.Count-1 then; |