Sign in Join
Wiki copytemporary

TDBGrid/fr

English · Français · Русский · 日本語

TDBGrid est un composant qui affiche les données d'un TDataSet sous forme tabulaire. Il est disponible depuis l'onglet Data Controls de la palette de composants.

pascal
    // configure connection with database
  SQLConnector1.ConnectorType := 'MySQL 5.1';
  SQLConnector1.HostName := 'MyServer';
  SQLConnector1.DatabaseName := 'MyDBName';
  SQLConnector1.UserName := 'MyName';
  SQLConnector1.Password := 'MyPass';
    // connect SQLConnector, SQLTransaction, DataSource, SQLQuery and DBGrid
  SQLTransaction1.Database := SQLConnector1;
  SQLQuery1.Transaction := SQLTransaction1;
  DataSource1.DataSet := SQLQuery1;
  DBGrid1.DataSource := DataSource1;
    // setup query to get (at least) two fields from MyTable
  SQLQuery1.SQL := 'SELECT * FROM MyTable';
    // setup grid with result from query
  DBGrid1.Columns[0].Title.Caption := 'Name';
  DBGrid1.Columns[0].FieldName := 'fieldDescription';
  DBGrid1.Columns[1].Title.Caption := 'Description';
  DBGrid1.Columns[1].FieldName := 'fieldName';
    // Open result and show in grid
  SQLQuery1.Open();

Voir aussi


From the Free Pascal wiki, page "TDBGrid/fr", as it stood on 2020-02-29 after a change by Trev, 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.

Revision 1, last changed by WikiArchive .

Edited on wiki.freepascal.org by 2 people, 2017–2020

From the official wiki's backup of 26 May 2024: who edited this page there, and when. Edits made there after that date were not recorded, and the earlier versions are not shown here; the main page says why.

WhenWhoWhat changed
E-ricCreated page
TrevFixed syntax highlighting (minor)

Talk about this page

Nobody has opened a bench for this page yet. Sign in to open one.