Click here to Skip to main content
15,305,969 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Really dump question here so I am really sorry in advance.
I'm trying to get the data from an mdb file with multiple tables.
The data I want are inside a table named Group.

When I try to query using:
OleDbCommand myAccessCommand = new OleDbCommand("SELECT * FROM Group", Myconnection);
i get a System.Data.OleDb.OleDbException: 'Syntax error in FROM clause.'
since it is trying to make a group of the returning results instead of filtering based on table name.

Any idea on how I can do it correctly? Thanks!

What I have tried:

Tried different overloads to force group to be taken as text instead of a command.
Posted
Updated 18-Jul-21 3:07am

1 solution

Never mind. The solution is to put the name inside square brackets like this:
SELECT * FROM [Group]
   
Comments
Richard MacCutchan 18-Jul-21 11:21am
   
A better solution is not to use reserved words for the names in the database.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900