FROM 子句 Access 中的语法错误
Syntax error in FROM clause Access
我想从 Access 数据库中读取数据以检查密码是否正确。我使用此代码:
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;
}
}
它在代码执行时给了我一个 "Syntax error in FROM clause."。
"User"是Access的保留字。
这是保留字列表:
http://support.microsoft.com/kb/286335/en-us
这是描述该问题的页面:
http://support.microsoft.com/kb/181489/en-us
我想从 Access 数据库中读取数据以检查密码是否正确。我使用此代码:
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;
}
}
它在代码执行时给了我一个 "Syntax error in FROM clause."。
"User"是Access的保留字。
这是保留字列表: http://support.microsoft.com/kb/286335/en-us
这是描述该问题的页面: http://support.microsoft.com/kb/181489/en-us