Error in from clause

  • Thread starter Thread starter Roel Van den Brande
  • Start date Start date
R

Roel Van den Brande

Hello

I try to fill a dataset. This is my code

string myConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data
source= C:\\Inetpub\\wwwroot\\Notenhof\\data\\notenhof.mdb;";
OleDbConnection myConnection = new OleDbConnection(myConnectionString);
myConnection.Open();

DataSet ds = new DataSet();
OleDbDataAdapter dtad = new OleDbDataAdapter("SELECT * FROM
user",myConnection);
dtad.Fill(ds);

When I execute: dtad.Fill(ds); I get the following error:

System.Data.OleDb.OleDbException: Syntax error in FROM clause.

This is very strange because user is a valid table...

Thx for helping me
Roel
 
Hi, Roel Van den Brande,

You should escape the tablename because it is a reserved word:

"SELECT * FROM [user]"

Greetings
Martin
 
You solved my problem !
Thank you very much...

Regards
Roel

Martin Dechev said:
Hi, Roel Van den Brande,

You should escape the tablename because it is a reserved word:

"SELECT * FROM [user]"

Greetings
Martin
Roel Van den Brande said:
Hello

I try to fill a dataset. This is my code

string myConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data
source= C:\\Inetpub\\wwwroot\\Notenhof\\data\\notenhof.mdb;";
OleDbConnection myConnection = new OleDbConnection(myConnectionString);
myConnection.Open();

DataSet ds = new DataSet();
OleDbDataAdapter dtad = new OleDbDataAdapter("SELECT * FROM
user",myConnection);
dtad.Fill(ds);

When I execute: dtad.Fill(ds); I get the following error:

System.Data.OleDb.OleDbException: Syntax error in FROM clause.

This is very strange because user is a valid table...

Thx for helping me
Roel
 
Back
Top