Difference between revisions of "TDataSet"
From Lazarus wiki
Jump to navigationJump to search(4 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
+ | {{TDataSet}} | ||
+ | |||
'''TDataSet''' is the main link to the actual data in a database. A TDataSet descendant acts like a cursor on a table or query-result. | '''TDataSet''' is the main link to the actual data in a database. A TDataSet descendant acts like a cursor on a table or query-result. | ||
− | <syntaxhighlight> | + | <syntaxhighlight lang=pascal highlight=3> |
SQLTransaction1.Database := SQLConnection1; | SQLTransaction1.Database := SQLConnection1; | ||
SQLQuery1.Transaction := SQLTransaction1; | SQLQuery1.Transaction := SQLTransaction1; | ||
− | DataSource1. | + | DataSource1.DataSet := SQLQuery1; |
DBGrid1.DataSource := DataSource1; | DBGrid1.DataSource := DataSource1; | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | A dataset (for example a query | + | A dataset (for example a query result) can be edited: |
− | <syntaxhighlight> | + | |
+ | <syntaxhighlight lang=pascal> | ||
ds.Edit(); | ds.Edit(); | ||
ds.FieldByName('NAME').AsString := 'Edited name'; | ds.FieldByName('NAME').AsString := 'Edited name'; | ||
− | + | ds.Post(); | |
ds.UpdateMode := upWhereAll; | ds.UpdateMode := upWhereAll; | ||
ds.ApplyUpdates(); | ds.ApplyUpdates(); | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | == | + | == Non-abstract descendants == |
+ | |||
* [[TBufDataset]] - | * [[TBufDataset]] - | ||
* [[TMemDataset]] - | * [[TMemDataset]] - | ||
Line 23: | Line 27: | ||
* [[TFixedFormatDataSet]] | * [[TFixedFormatDataSet]] | ||
* [[TDbf]] - connect to dBase | * [[TDbf]] - connect to dBase | ||
− | * [[TParadox]] - connect to Paradox/BDE | + | * [[TParadox]] - connect to Paradox/BDE (needs dlls, less features, read/write) |
− | * [[TParadoxDataSet]] - connect to Paradox/BDE | + | * [[TParadoxDataSet]] - connect to Paradox/BDE (more features, read-only) |
* [[TFPCodeGenerator]] | * [[TFPCodeGenerator]] | ||
* [[TSQLQuery]] - connect to results of a SQL-query | * [[TSQLQuery]] - connect to results of a SQL-query | ||
== See also == | == See also == | ||
+ | |||
* [[doc:fcl/db/tdataset.html|TDataSet doc]] | * [[doc:fcl/db/tdataset.html|TDataSet doc]] | ||
* [[TBufDataset]] | * [[TBufDataset]] | ||
Line 34: | Line 39: | ||
{{LCL Components}} | {{LCL Components}} | ||
− | |||
− |
Latest revision as of 09:22, 11 August 2021
│
English (en) │
français (fr) │
日本語 (ja) │
polski (pl) │
русский (ru) │
TDataSet is the main link to the actual data in a database. A TDataSet descendant acts like a cursor on a table or query-result.
SQLTransaction1.Database := SQLConnection1;
SQLQuery1.Transaction := SQLTransaction1;
DataSource1.DataSet := SQLQuery1;
DBGrid1.DataSource := DataSource1;
A dataset (for example a query result) can be edited:
ds.Edit();
ds.FieldByName('NAME').AsString := 'Edited name';
ds.Post();
ds.UpdateMode := upWhereAll;
ds.ApplyUpdates();
Non-abstract descendants
- TBufDataset -
- TMemDataset -
- TSdfDataSet -
- TFixedFormatDataSet
- TDbf - connect to dBase
- TParadox - connect to Paradox/BDE (needs dlls, less features, read/write)
- TParadoxDataSet - connect to Paradox/BDE (more features, read-only)
- TFPCodeGenerator
- TSQLQuery - connect to results of a SQL-query
See also