TDBGrid/ja: what changed
Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.
Title: TDBGrid/ja
| Old | New | Line | |
|---|---|---|---|
| 1 | + | **TDBGrid** はTDataSet派生の[[TSQLQuery/ja|TSQLQueryはなどを]]介してデータベースの内容から、表形式のデータを表示をする視覚的コンポーネントである。TDBGridは[[Component Palette/ja|Component Paletteの]][[Data Controls/ja|Data Controls タブで]]利用できる。 | |
| 2 | + | ||
| 3 | + | ``` pascal | |
| 4 | + | // データベースとの接続を確立 | |
| 5 | + | SQLConnector1.ConnectorType := 'MySQL 5.1'; | |
| 6 | + | SQLConnector1.HostName := 'MyServer'; | |
| 7 | + | SQLConnector1.DatabaseName := 'MyDBName'; | |
| 8 | + | SQLConnector1.UserName := 'MyName'; | |
| 9 | + | SQLConnector1.Password := 'MyPass'; | |
| 10 | + | // SQLConnector、SQLTransaction、DataSource、SQLQuery、DBGridに接続する | |
| 11 | + | SQLTransaction1.Database := SQLConnector1; | |
| 12 | + | SQLQuery1.Transaction := SQLTransaction1; | |
| 13 | + | DataSource1.DataSet := SQLQuery1; | |
| 14 | + | DBGrid1.DataSource := DataSource1; | |
| 15 | + | // MyTableから(少なくとも)2つのフィールドを取得するセットアップクエリ | |
| 16 | + | SQLQuery1.SQL := 'SELECT * FROM MyTable'; | |
| 17 | + | // クエリからの結果でグリッドをセットアップ | |
| 18 | + | DBGrid1.Columns[0].Title.Caption := 'Name'; | |
| 19 | + | DBGrid1.Columns[0].FieldName := 'fieldDescription'; | |
| 20 | + | DBGrid1.Columns[1].Title.Caption := 'Description'; | |
| 21 | + | DBGrid1.Columns[1].FieldName := 'fieldName'; | |
| 22 | + | // 結果を開きグリッドに表示 | |
| 23 | + | SQLQuery1.Open(); | |
| 24 | + | ``` | |
| 25 | + | ||
| 26 | + | ## 以下も参照のこと | |
| 27 | + | ||
| 28 | + | - [[doc:lcl/dbgrids/tdbgrid.html|TDBGrid doc]] | |
| 29 | + | - [[TdxDBGridController]] | |
| 30 | + | - [[TStringGrid]] | |
| 31 | + | - [[Grids Reference Page]] | |
| 32 | + | - [[TDataSource]] | |
| 33 | + | ||
| 34 | + | --- | |
| 35 | + | *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](/wiki-contact).* |
