diff options
author | graemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf> | 2008-04-14 13:11:49 +0000 |
---|---|---|
committer | graemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf> | 2008-04-14 13:11:49 +0000 |
commit | 6660740cf39f01309e27ace4c8f27eb0827ec41f (patch) | |
tree | 9e99a265abb2b2037351587e83671a652bc52afd /examples | |
parent | 5dfc6a2d20122bd03bff22f1be99e69910bab388 (diff) | |
download | fpGUI-6660740cf39f01309e27ace4c8f27eb0827ec41f.tar.xz |
* Extended the dbtest example to show how the test.dbf database was created.
Diffstat (limited to 'examples')
-rw-r--r-- | examples/gui/dbtest/frm_main.pas | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/examples/gui/dbtest/frm_main.pas b/examples/gui/dbtest/frm_main.pas index f5f0a722..83b25f7e 100644 --- a/examples/gui/dbtest/frm_main.pas +++ b/examples/gui/dbtest/frm_main.pas @@ -7,7 +7,7 @@ interface uses SysUtils, Classes, fpgfx, gfx_widget, gui_form, gui_label, gui_button, - gui_listbox, gui_bevel, fpgui_db, db, dbf; + gui_listbox, gui_bevel, fpgui_db, db, dbf{, dbf_fields}; type @@ -89,10 +89,27 @@ constructor TMainForm.Create(AOwner: TComponent); var x: Integer; s: string; +// fields: TDbfFieldDefs; begin inherited Create(AOwner); DataSet := TDBF.Create(Self); DataSet.TableName := 'test.dbf'; + + // If you wanted to create a new DBF table +{ + fields := TDbfFieldDefs.Create(self); + fields.Add('Name', ftString, 50); + fields.Add('Address', ftString, 150); + DataSet.CreateTableEx(fields); // <== Now we have an empty db table + + DataSet.Open; + + Dataset.Insert; // <== Start inserting data + Dataset.FieldByName('Name').AsString := 'Graeme Geldenhuys'; + Dataset.FieldByName('Address').AsString := 'graemeg@nospam.co.za'; + DataSet.Post; +} + DataSource := TDataSource.Create(Self); DataSource.DataSet := DataSet; |