0
我想從Access數據庫讀取數據以檢查密碼是否正確。我使用這段代碼:FROM子句中的語法錯誤訪問
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;
}
}
它給了我一個「FROM子句中的語法錯誤」。代碼執行時。
用戶是在Access中保留字。我認爲你可以使用反引號來允許它,但建議將該表名改爲「用戶」或其他東西 – 2015-01-31 18:49:15
謝謝很多工作 – 2015-01-31 18:53:28