|go ahead... be a heretic|
Re: accessing field names in Access table?by digger (Friar)
|on Sep 18, 2003 at 14:12 UTC||Need Help??|
I am just getting into a project that requires me to use an Access db for the backend. I settled on using Win32::ODBC . There is an excellent tutorial here on getting started with the module, and it is very easy.
The only issue I struggled with is the ODBC connection string. If you can create a system DSN, you don't need to worry. But if not, you will have to write your own connection string.
The format is
After you have your connection string, get the field names with the following code:
This will give you an array containing all of the field names in the data set retrieved by the SQL statement.
One last gotcha - the method calls are case sensitive in this module, so make sure your calls have the same capitalization as the docs.
Of course, all of this assumes you are working on a win32 platform. If you are on *nix platform, ignore everything I said. There is currently no way to use an Access db natively on *nix. There are the mdbtools mentioned above, and some software that will create a remote connection to win32 box to work with an Access db, but nothing native...yet.
Good Luck and Happy Coding,