Sign in Join
Wiki copytemporary

TDBGrid/ja

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

TDBGrid はTDataSet派生のTSQLQueryはなどを介してデータベースの内容から、表形式のデータを表示をする視覚的コンポーネントである。TDBGridはComponent PaletteのData Controls タブで利用できる。

pascal
    // データベースとの接続を確立
  SQLConnector1.ConnectorType := 'MySQL 5.1';
  SQLConnector1.HostName := 'MyServer';
  SQLConnector1.DatabaseName := 'MyDBName';
  SQLConnector1.UserName := 'MyName';
  SQLConnector1.Password := 'MyPass';
    // SQLConnector、SQLTransaction、DataSource、SQLQuery、DBGridに接続する
  SQLTransaction1.Database := SQLConnector1;
  SQLQuery1.Transaction := SQLTransaction1;
  DataSource1.DataSet := SQLQuery1;
  DBGrid1.DataSource := DataSource1;
    // MyTableから(少なくとも)2つのフィールドを取得するセットアップクエリ
  SQLQuery1.SQL := 'SELECT * FROM MyTable';
    // クエリからの結果でグリッドをセットアップ
  DBGrid1.Columns[0].Title.Caption := 'Name';
  DBGrid1.Columns[0].FieldName := 'fieldDescription';
  DBGrid1.Columns[1].Title.Caption := 'Description';
  DBGrid1.Columns[1].FieldName := 'fieldName';
    // 結果を開きグリッドに表示
  SQLQuery1.Open();

以下も参照のこと


From the Free Pascal wiki, page "TDBGrid/ja", as it stood on 2024-03-21 after a change by Ariben, 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 1 person, 2024

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
AribenCreated page
Ariben
Ariben
Ariben

Talk about this page

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