I have a program that fetch data from database. I have two different databases (MSAccess and Oracle). I kept receiving "Syntax error in FROM clause" if I set the connection to MSAccess but it works fine with Oracle.
Here's the code:
using (IDbConnection connection = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\CYME\DB\cyme-31R2.mdb"))
{
connection.Open();
string query = $"SELECT g.NetworkID, g.ACTIVEGENERATION, g.DEVICENUMBER, g.DEVICETYPE, u.DATAVALUESTR as PremiseId " +
$"FROM CYMDGGENERATIONMODEL g " +
$"JOIN CYMDEVICEUDD u ON g.DEVICENUMBER = u.DEVICENUMBER " +
$"JOIN CYMLOADMODEL m ON g.LOADMODELID = m.LOADMODELID " +
$"WHERE u.DATAVALUESTR IS NOT NULL AND u.DATAID='PremiseID' AND m.LOADMODELNAME='LFM' AND g.DEVICETYPE = 37 " +
$"GROUP BY g.NetworkID, g.ACTIVEGENERATION, g.DEVICENUMBER, g.DEVICETYPE, u.DATAVALUESTR";
var result = connection.Query<CymDGGenerationModel>(query).ToList();
return result;
}
For your information, table "CYMDGGENERATIONMODEL" and "CYMDEVICEUDD" are created but have no data for Access. Is this the reason I received that error or it's something else? Thanks in advance.