DBGrid. . , , . , ., . .. , Columns DBGrid. , . , . , Columns.
. (. 2.4.). , Add ( ) FieldName. To , Add. A : Add All Fields ( ). , Table. Delete ( ) , .
. 2.4.
, Edenica, . , ButtonStyle. . ButtonStyle , . 1.
1
ButtonStyle
cbsAuto | , |
cbsEllips | ... OnEditButtonClick DBGrid (. . 2.5) |
cbsNone | - |
cbsAuto ( ), PickList, . Edenica PickList ., . .. , , (. 2.6).
, cbsAuto , . . , PickList , .
ButtonStyle cbsNone, - .
|
|
DBGrid , . : , , - . , Data Control , DBGrid.
. 2.5. Edinica ButtonStyle= cbsEllips
.
DBText Label, . , . : , , . .
. 2.6. Edinica ButtonStyle= cbsAuto
DBEdit Edit. : , , . , Readonly=true, , DBText, , , DBText.
DBMemo Memo. Memo, , .
DBRichEdit RTF. , DBMemo.
DBlmage Image. .
DBCheckBox CheckBox. . true, . , . , , DBGrid.
DBRadioGroup RadioGroup. . Items, , . Values, , . , . Values , Items, .. . DBRadioGroup , .
, . : DataSource ( TDataSour) DataField , .
, , , : Caption DBText, Text DBEdit, Picture DBImage .. , . , , , . , .
|
|
Session
Session . Session, Delphi Session , . Session.
Session BDE. Session. , . (. 2.7) TComboBox. , . TDBGrid, DataSourcel Table 1.
. 2.7. ,
, cbDatabase BDE . , OnCreate :
Session.GetAliasNames(ComboBox1.Items);
GetAliasNames Session, TStrings ( cbAlias.Items) , BDE.
cbAlias cbTable . OnChange cbAlias :
Sesion.GetTableNames(ComboBox1.Text,'',true,false,ComboBox2. Items);
ComboBox2.ItemIndex:=0;
GetTableNames TStrings ( ComboBox2.Items) , ( ComboBox1.Text). , . , * , . , , . , true, , ( Paradox dBase). false Paradox dBase, , SQL, true, , . . :
If ComboBox2.Text='' then
begin
ShowMessage(' ');
end;
Table1.Active:=false;
Table1.DatabaseName:=ComboBox1.Text;
Table1.TableName:=ComboBox2.Text;
Table1.Active:=true;
end;
DatabaseName TableName Table1 , ble1 .
.
Session, . Session , . Session , . Session SessionName , , , s1. SessionName TDatabase, bl, TQuery .. . Session.
|
|
Session, Session - . TSessionsList Session.
Batch Move
BatchMove . : Source Destination TTable. Mode . 2.
2
Mode BatchMove
batAppend | , . . |
. 2
batUpdate | , , . . . |
batAppendUpdate | , , . , , . . |
batDelete | , , . |
batCopy | . , |
Execute . MovedCount , -.
, - -. AbortOnProblem , , - -. AbortOnProblem = false ProblemTableName. Paradox, , . ProblemCount , . AbortOnProblem = false - -. , BatchMove - -. , .
|
|
- , -, , , AbortOnKeyViol , , -. AbortOnKeyViol = false KeyViolTableName. Paradox, , - . KeyViolCount .
, TBatchMove , -. ChangedTableName, Paradox, -. ChangedCount , - ( Mode = batUpdate batAppendUpdate), ( Mode = batDelete). ChangedTableName.
Mappings TStrings . , . , Mappings . Mappings, . -, , . . , Mappings, . , , . , Mappings :
Pokupatel,
Pokupatel Dep . :
Pokupatel= NewPokupatel,
Pokupatel NewPokupatel ! , BatchMove , , . , BatchMove. Example, a . Example2.
Table, DataSource DBGrid. (Table1, DataSource1 DBGrid1) Example. - Example, DBGrid1 . (Table2, DataSource2 DBGrid2) , bl2 . , .
BatchMove. Source Table1, Destination bl2. Mode , , batCopy. . Labe1 . Button, . , batCopy, batAppend .. , Example2.
private Exec, . :
Procedure TForm1.Exec;
begin
Table2.Active:=false;
Table2.DatabaseName:=Table1.DatabaseName;
Table2.TableName:='Example2.db';
If (BatchMove1.Mode=batCopy) or (Table2.Exists) then
begin
BatchMove1.Execute;
Table2.Active:=true;
Label1.Caption:=''+
IntToStr(BatchMove1.MovedCount)+' ';
end
else ShowMessage(' '+
#13+ ' ');
end;
- . -. batCopy ( Exists), , , batCopy, . , - , DBGrid2 . Label1 -.
|
|
, , Exec. , :.
BatchMove1.Mode:=batCopy;
Exec;
. , BatchMovel.Mode.
:
If Table2.Exists then
begin
Table2.Active:=false;
Table2.DeleteTable;
end;
- , DeleteTable.
(Refresh)
, , . , , . - , TTable, , , , . , .
Refresh Open , , . , , Delphi . , , Delphi . , , . Refresh, Close Open.
, , TTable . , , , , Refresh. , , Refresh . , , , .
(Bookmarks)
, . Delphi , .
function GetBookmark: TBookmark;
( )
procedure GotoBookmark(Bookmark: TBookmark);
( )
procedure FreeBookmark(Bookmark: TBookmark);
( )
, GetBookmark TBookmark. TBookmark , Delphi , TBookmark. TBookmark GotoBookmark , .
, GetBookmark TBookmark, FreeBookmark Tbookmark ( GetBookMark).
, 1, , , .