Accessing data from an Access DB
Posted on 2003-03-24
I have a simple form with 1 editbox for input and 5 editboxs for outputs.
What I want to do is be able to input a CountryFrom code eg AUD and it will return all the conversion rates. See table below.
ConID CountryFrom AUD NZD DEM FRF USD
1 AUD 1 1.321898 1.24422 4.172943 0.574098
2 NZD 0.756486 1 0.941238 3.156774 0.434299
3 DEM 0.803716 1.062429 1 3.351981 0.604778
4 FRF 0.229639 0.316778 0.298331 1 0.180424
5 USD 1.841856 2.302555 1.6535 7.5425 1
I have a Database connection using ODBC and BDE Alias. On my form I have a TDatabase component and a TTable component. Both these are pointing to the DB.
Please help, I can't seem to find any decent info on the net to help me do this. I know how to do the SQL statement in Access but I am not sure how to do it in Delphi - (SELECT CountryFrom, AUD, NZD, DEM, FRF, USD FROM CurrencyTable WHERE CountryFrom = 'NZD';).
Do I need to create a connection and close? How do I store each value to a variable?
If you require more info from me please let me know.
Thanks heaps in advance.