MS Access DB with Spaces in Column Name
843859Jul 17 2007 — edited Aug 1 2007Good Afternoon-
I'm having some serious headaches with a table that I need to extract information from. The powers that be wrote it with the following column names "Contract Number" , "Customer Number", "Description".
Note the spaces in the columns.
Sample code from here: http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=2691&lngWId=2
I'm using sample code for connecting to the database and I can access everything using the select statements, except if the column contains a space. I get the following errors:
s.execute("select [Customer Number], Name from Customer");
Error: java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.
s.execute("select \"Customer Number\", Name from Customer");
Error: java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.
s.execute("select Customer*Number, Name from Customer");
Error: java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 2.
s.execute("select 'Customer Number' , Name from Customer");
Data from column_name: Customer Number , Unknown
This works, but would require parsing-
s.execute("select * from Customer");
Data from column_name: 5 , Unknown
Suggestions would be truly appreciated.
Jason