?
Solved

Trouble with System.Data.OleDb and table names with underscores

Posted on 2006-05-24
5
Medium Priority
?
304 Views
Last Modified: 2012-08-14
When trying to access a table with an underscore in it ie (PO_A1) the data provider throws an exception ("The Microsoft Jet database engine cannot find the input table or query 'PO_A1'.  Make sure it exists and that its name is spelled correctly."). I've tried enclosing the table name in square brackets ... doesn't work. Before anyone tells me to change the name of the table... I didn't create it and its spread throughout our code. Anyone have a work around

0
Comment
Question by:bensonwalker
  • 3
  • 2
5 Comments
 
LVL 13

Expert Comment

by:John Mc Hale
ID: 16760047
1. Maybe a problem with the OleDB connection string?

2. Maybe table name is P0_A1, not PO_A1?

Just my 10 cent!
0
 
LVL 13

Expert Comment

by:John Mc Hale
ID: 16760049
PS: the underscore SHOULD not be a problem!
0
 
LVL 1

Author Comment

by:bensonwalker
ID: 16760332
No the table name is correct I've tried it with other tables as well with and without an underscore it consistently fails when the table name contains and underscore
0
 
LVL 13

Accepted Solution

by:
John Mc Hale earned 200 total points
ID: 16761494
Can you use OleDB to access the database schema and spew out the names of all the TableDefs in the schma design. I don't know but that might shed some light on it. The database platform hosting the actual database might have something to do with it, such as enforcing user schemas in which case, it might require the username to be prepended to the table name, e.g.  bensonwalker.PO_A1, before allowing access to the database.

Other than those suggestions, quite frankly i'm stumped. Not being able (in fact encouraged) to use underscores in table names would be a serious blow to the database designer population!
0
 
LVL 1

Author Comment

by:bensonwalker
ID: 16762973
After further investigation I have discovered that the tables in question are stored in a separate database.... duh.. you get the points for putting up with me.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
In a use case, a user needs to close an opened report by simply pressing the Escape (Esc) key. This can be done by adding macro code in Report_KeyPress or Report_KeyDown event.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Suggested Courses

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question