Reputation: 123
I'm querying an access table called AC_ECONOMIC using VS 2012 C# WinForms Application. Here's my code,
con6 = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + filePath);
//string propQuery = String.Format("SELECT PROPNUM FROM [AC_ECONOMIC]");// WHERE SECTION = 4 AND QUALIFIER = CGA0112");
ad6.SelectCommand = new OleDbCommand("SELECT DISTINCT PROPNUM FROM [AC_ECONOMIC] WHERE SECTION = 4 AND QUALIFIER = '" + qual0 + "'", con6);
ds6.Clear();
con6.Open();
ad6.SelectCommand.ExecuteNonQuery(); //ERROR HERE
ad6.Fill(ds6);
con6.Close();
I keep getting the error,
"IErrorInfo.GetDescription failed with E_FAIL(0x80004005)."
If I take the SECTION = 4 AND out of the query it doesn't give me there error but that's not the spefic data I'd like to get. Can any tell me why I'm getting this error? Any help would be great.
Upvotes: 1
Views: 68
Reputation: 39777
SECTION
is a reserved access keyword, try to include it into square brackets or backticks:
WHERE [SECTION] = 4
or
WHERE `SECTION` = 4
Upvotes: 2