0

I want to read the data from Access Database in order to check if a password is correct or not. I use this code:

var check=false;
OleDbCommand c = new OleDbCommand();
c.Connection = co //the connection to the Database;
c.CommandText = "select * FROM User Where user_name='"+usee+"'"; 
OleDbDataReader re = c.ExecuteReader();
while (re.Read())
{
    if (re.ToString() == pasy)
    {
        check = true;
    }
}

It gives me a "Syntax error in FROM clause." when the code executes.

Jarlax
  • 1,586
  • 10
  • 20
  • 1
    User is a reserved word in Access. I think you can use backticks to allow it, but suggest changing that table name to `Users` or something else – Ryan J Jan 31 '15 at 18:49

1 Answers1

0

"User" is a reserved word for Access.

Here is a list of reserved words : http://support.microsoft.com/kb/286335/en-us

and here is a page describing that problem : http://support.microsoft.com/kb/181489/en-us

Mickael V.
  • 1,109
  • 11
  • 21