TDataSource: what changed
Revision 1 to 2. Removed lines have a minus sign; added lines have a plus sign.
| Old | New | Line | |
|---|---|---|---|
| 1 | 1 | **TDataSource**  is a component that mediates communication between a [[TDataSet]] based component that represents the database contents and Data Controls like [[TDBGrid]]. | |
| 2 | 2 | ||
| 3 | 3 | Typically, a `TDataSource` contains a field 'DataSet' that connects to a [[TSQLQuery]] or other `TDataSet` descendant. The DataSource should connect to the 'DataSource' field of a TDBGrid or other Data Control component. | |
| 4 | 4 | ||
| 5 | - | ||
| 6 | - | ||
| 7 | - | ||
| 8 | - | ||
| 5 | + | ``` pascal | |
| 6 | + | SQLTransaction1.Database := SQLConnection1; | |
| 7 | + | SQLQuery1.Transaction := SQLTransaction1; | |
| 8 | + | DataSource1.DataSet := SQLQuery1; | |
| 9 | + | DBGrid1.DataSource := DataSource1; | |
| 10 | + | ``` | |
| 9 | 11 | ||
| 10 | 12 | ## See also | |
| 11 | 13 | ||
| 12 | 14 | - [[doc:fcl/db/tdatasource.html|TDataSource doc]] | |
| 13 | 15 | - [[TSQLTransaction]] | |
| 14 | 16 | - [[TSQLQuery]] | |
| 15 | 17 | ||
| 16 | 18 | --- | |
| 17 | 19 | *From the Free Pascal wiki, page "TDataSource", as it stood on 2017-06-14 after a change by E-ric, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).* |
