ADO vs Jet: Name of table as USER get problems

Hi all,

I migrating from DAO to ADO and using the Jet Engine. In the database I have defined table with name 'USER'. When I trying to open recordset with this table in FROM clause, the MS Jet will retrieve the following error: Error in FROM clause. But when I rename it, all is working fine.
So it looks for me like this table is already used internally, or...

Thanks for your help
[413 byte] By [Kuko] at [2007-11-17 13:03:43]
# 1 Re: ADO vs Jet: Name of table as USER get problems
Did you ever get an answer to this? If not, what program are you using to open the recordset using ADO?
If it is in VB or ASP, the I can probably help.
It may just be that the keyword "USER" is reserved (it is in most programs-either internally or by Jet Engine).
Also, Jet Engine isn't always the best with ADO (from my experience). In fact, I try to stay away from Jet Engine whenever possible, but that's just my personal preference.
goddess_spanky at 2007-11-10 3:32:09 >
# 2 Re: ADO vs Jet: Name of table as USER get problems
First thanks for interest.
I'm working under C++, but doesn't matter.
Here I have an example of this under VB:

Private Sub Command1_Click()
Dim con As New ADODB.Connection
Dim rs As New ADODB.Recordset
con.Open "Data Source=G:\d.mdb;Provider=Microsoft.Jet.OLEDB.4.0;"
rs.ActiveConnection = con
rs.Open "SELECT * FROM USER"
End Sub

but first please create the database with table 'USER'. The 'Open' method will then fail.
When you change the name of table (in database and in code) to 'USERS' all is working fine.

Thanks again
Kuko at 2007-11-10 3:33:09 >
# 3 Re: ADO vs Jet: Name of table as USER get problems
i know this will sound silly, but try adding a semicolon after the table name. Access generally like to have these to indicate the end of the sql statement. this little thing has fixed other "odd" situations before.

good luck,

john

John Pirkey
MCSD
http://www.ShallowWaterSystems.com
http://www.stlvbug.org
Johnny101 at 2007-11-10 3:34:11 >
# 4 Re: ADO vs Jet: Name of table as USER get problems
Evidently some words are reserved. I had the identical problem with a table name of SESSION.

Earl
earlallen at 2007-11-10 3:35:08 >
# 5 Re: ADO vs Jet: Name of table as USER get problems
try it this way

rs.Open "SELECT * FROM [USER]"
s_bist at 2007-11-10 3:36:18 >