AddWhere Error

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
eduardomendes
Posts: 28
Joined: Wed 24 Feb 2010 14:08

AddWhere Error

Post by eduardomendes » Fri 02 Dec 2011 17:53

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!

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Post by AlexP » Mon 05 Dec 2011 12:13

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.

Post Reply