A
AleXmanFree
Hello World.
I have code that connects to Access file (.mdb) and executing query
that returnst table to my code, it has no matter here but code is on
C#, and the final point for the query result is
dbDataAdapter.Fill(tbl);
before this Fill(tbl) method my code dynamically generates SQL query
string , and depending on how many comboboxes user has selected so much
criterias and lines are added to query string, the problem is that in
cases when user selects 2 Languages (comboBoxes) query runs as should,
but when it is more then 2 languages the query raises Exception: Syntax
error (missing operator) in query expression ''. , but amazing for me
that this new generated SQL query that raises exception works correctly
if i run it in ms Sql, so query that generates my code syntactically is
right. SO i cant find the reason why it raises exception in code, i
think here something connected with Access file
distinctive feature that I dont know well here is queries example for 2
and 3 languages cases:
SQL for 2 languages:
SELECT Dictionary.[Text] AS Lang_0, Dictionary1.[Text] AS Lang_1
FROM Dictionary INNER JOIN
Dictionary Dictionary1 ON Dictionary.GroupID = Dictionary1.GroupID
AND Dictionary.LanguageCode <> Dictionary1.LanguageCode
WHERE (Dictionary.LanguageCode = 'en-us') AND (Dictionary1.LanguageCode
= 'fr-fr')
ORDER BY Dictionary.GroupID;
SQL for 3 languages:
SELECT
Dictionary.[Text] AS Lang_0,
Dictionary1.[Text] AS Lang_1,
Dictionary2.[Text] AS Lang_2
FROM Dictionary
INNER JOIN
Dictionary Dictionary1 ON Dictionary.GroupID = Dictionary1.GroupID
AND Dictionary.LanguageCode <> Dictionary1.LanguageCode
INNER JOIN
Dictionary Dictionary2 ON Dictionary.GroupID = Dictionary2.GroupID
AND Dictionary.LanguageCode <> Dictionary2.LanguageCode
WHERE
(Dictionary.LanguageCode = 'de-de') AND
(Dictionary1.LanguageCode = 'el') AND
(Dictionary2.LanguageCode = 'it-it')
ORDER BY Dictionary.GroupID;
I have code that connects to Access file (.mdb) and executing query
that returnst table to my code, it has no matter here but code is on
C#, and the final point for the query result is
dbDataAdapter.Fill(tbl);
before this Fill(tbl) method my code dynamically generates SQL query
string , and depending on how many comboboxes user has selected so much
criterias and lines are added to query string, the problem is that in
cases when user selects 2 Languages (comboBoxes) query runs as should,
but when it is more then 2 languages the query raises Exception: Syntax
error (missing operator) in query expression ''. , but amazing for me
that this new generated SQL query that raises exception works correctly
if i run it in ms Sql, so query that generates my code syntactically is
right. SO i cant find the reason why it raises exception in code, i
think here something connected with Access file
distinctive feature that I dont know well here is queries example for 2
and 3 languages cases:
SQL for 2 languages:
SELECT Dictionary.[Text] AS Lang_0, Dictionary1.[Text] AS Lang_1
FROM Dictionary INNER JOIN
Dictionary Dictionary1 ON Dictionary.GroupID = Dictionary1.GroupID
AND Dictionary.LanguageCode <> Dictionary1.LanguageCode
WHERE (Dictionary.LanguageCode = 'en-us') AND (Dictionary1.LanguageCode
= 'fr-fr')
ORDER BY Dictionary.GroupID;
SQL for 3 languages:
SELECT
Dictionary.[Text] AS Lang_0,
Dictionary1.[Text] AS Lang_1,
Dictionary2.[Text] AS Lang_2
FROM Dictionary
INNER JOIN
Dictionary Dictionary1 ON Dictionary.GroupID = Dictionary1.GroupID
AND Dictionary.LanguageCode <> Dictionary1.LanguageCode
INNER JOIN
Dictionary Dictionary2 ON Dictionary.GroupID = Dictionary2.GroupID
AND Dictionary.LanguageCode <> Dictionary2.LanguageCode
WHERE
(Dictionary.LanguageCode = 'de-de') AND
(Dictionary1.LanguageCode = 'el') AND
(Dictionary2.LanguageCode = 'it-it')
ORDER BY Dictionary.GroupID;