.


:




:

































 

 

 

 


5




1.

2. , :

 

TListBox, TQuery, TDataSource, TDBGrid, TMainMenu, (TMenuItem)

3. :

TQuery DatabaseName BCDEMOS, Name FormatQuery, SQL select * from:Table

TDataSource Name dsFormat, DataSet FormatQuery.

TDBGrid DataSource dsFormat, Align alClient

TList Align alLeft

4. TMainMenu Items StringTrick1

5. OnCreate . TListBox:

void __fastcall TForm::FormCreate(TObject *Sender)

{

Session->GetTableNames(FormatQuery->DatabaseName, , False, False, ListBox1->Items);

}

6. ListBox1.OnClick:

 

void __fastcall TForm1::ListBox1Click(TObject *Sender)

{

AnsiString S = ListBox1->Items->Strings[ListBox1->ItemIndex];

S = Format("Select * from %s", OPENARRAY(TVarRec, (S)));

Caption = S;

 

FormatQuery->Close();

FormatQuery->SQL->Clear();

FormatQuery->SQL->Add(S);

FormatQuery->Open();

}

GetQuery:

AnsiString GetQuery(AnsiString S1, AnsiString S2, int Value)

{

return Format("Select * from %s where %s = %d", OPENARRAY(TVarRec, (S1, S2, Value)));

}

OnClick:

void __fastcall TForm1::StringTrick1Click(TObject *Sender)

{

Caption = GetQuery("Customer", "CustNo", 42);

}

6. . .

 

 

1. ?

2. ?

3. Format ?

 





:


: 2015-10-01; !; : 399 |


:

:

80% - .
==> ...

1708 - | 1559 -


© 2015-2024 lektsii.org - -

: 0.009 .