Page 1 of 1

AddWhere Error

Posted: Fri 02 Dec 2011 17:53
by eduardomendes
Hi,

when trying use AddWhere and SetOrderBy occurs error.

Ex:
UniTable.SetOrderBy('id');
UniTable.AddWhere('((id = 1)');
UniTable.AddWhere('(name = '''test'''))');

Result Query:

SELECT * FROM table
WHERE ((id = 1) ORDER BY id (name = 'test'))



How can I fix this problem?

Thanks!

Posted: Mon 05 Dec 2011 12:13
by AlexP
Hello,

A valid SQL query should be received after adding any of the operators (ORDER BY, WHERE). In the code sample you've sent us, the SQL query received after calling the AddWhere is invalid. To solve this problem, you should either add the WHERE section using one operator, or remove all brackets, or call SetOrderBy after adding the WHERE section completely.