Shaitan00 Posted November 6, 2005 Posted November 6, 2005 I am trying to write an application that can use either an Access or Excel Database file, I found that with the correct Connection Strings you can connect and manipulate either one (which is GREAT). However oddly enough there seems to be a difference when calling/accessing the tables, my Access Database has a table called "Clients" and the Excel Database has a table/worksheet called "Clients" - logically accessing them would be the same... but it is not. For example, the following works: Access = ds = oDB.Read("SELECT DISTINCT [CLIENTS] FROM [Clients] ORDER BY [CLIENTS]"); Excel = ds = oDB.Read("SELECT DISTINCT [CLIENTS] FROM [Clients$] ORDER BY [CLIENTS]"); [/Code] Notice the "$" in the "FROM [Clients]" part that differs, also note that both of these currently work fine as-is. If I don't put the $ for EXCEL I get the following error: "System.Data.OleDb.OleDbException: The Microsoft Jet database engine could not find the object 'Clients'. Make sure the object exists and that you spell its name and the path name correctly." As shown there is a difference between ACCESS and EXCEL, why? Is there a way to standardize this? I would hate to have to check if the user selected Excel or Access and modify my TableNames on the fly to match the required type. Why would Excel need a "$" when calling a table when Access and SQL don't? Any clues how to get around this? Thanks, Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.