EXAMPLE 47
TAdvStringGrid
example 47 : using the new capability to load data from MDB files
2 New methods enable loading of Access tables in the grid : LoadFromMDBSQL and LoadFromMDBTable. Both methods use ADO. Note that this imposes no requirements at all for grids that do not use this feature on the availability of ADO on the target machine.Description:
LoadFromMDBTable(Filename, Table:string);
This method loads the selcted table from the MDB file into TAdvStringGrid. From there, it can be printed, exported to HTML, CSV etc ..
LoadFromMDBSQL(Filename, SQL:string);
This method allows using an Access compatible SQL statement to retrieve the data from an Access file. Suppose the MDB file has a table CARS and only the cars from this table with 6 or more cylinders need to be loaded into the grid. In this case you can write :
AdvStringGrid1.LoadFromMDBSQL('mydb.mdb','SELECT * FROM CARS WHERE CYL >= 6');
Delphi project & source files for downloading included in the main demos distribution for Delphi.
The project and source files have been written with Delphi 6,7. To use these files in other versions of Delphi, ignore any remarks when opening the form files and save the files. After this, compilation can be done. The error messages are due to properties included in the Delphi 6 form file, but not available in lower versions of Delphi.


ONLINE ORDERS
Subscribe to RSS Feed