Difference between revisions of "TDataSource"

From Free Pascal wiki
Jump to navigationJump to search
(Created page with "<tt>'''TDataSource'''</tt> is a component that mediates communication between a <tt>TDataSet</tt> based component that represents the database contents and Data Controls l...")
 
Line 2: Line 2:
  
 
Typically, a <tt>TDataSource</tt> contains a field 'DataSet' that connects to a <tt>[[TSQLQuery]]</tt> or other <tt>TDataSet</tt> descendant.  The DataSource should connect to the 'DataSource'  field of a TDBGrid or other Data Control component.
 
Typically, a <tt>TDataSource</tt> contains a field 'DataSet' that connects to a <tt>[[TSQLQuery]]</tt> or other <tt>TDataSet</tt> descendant.  The DataSource should connect to the 'DataSource'  field of a TDBGrid or other Data Control component.
 +
 +
  SQLTransaction1.Database := SQLConnection1;
 +
  SQLQuery1.Transaction := SQLTransaction1;
 +
  DataSource1.DataSet := SQLQuery1;
 +
  DBGrid1.DataSource := DataSource1;
  
 
== Freepascal Documentation ==
 
== Freepascal Documentation ==

Revision as of 22:56, 2 July 2014

TDataSource is a component that mediates communication between a TDataSet based component that represents the database contents and Data Controls like TDBGrid.

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.

 SQLTransaction1.Database := SQLConnection1;
 SQLQuery1.Transaction := SQLTransaction1;
 DataSource1.DataSet := SQLQuery1;
 DBGrid1.DataSource := DataSource1;

Freepascal Documentation

  • http: //www.freepascal.org/docs-html/fcl/db/tdatasource.html