Problem with joined tables

Discussion of open issues, suggestions and bugs regarding usage of dbExpress drivers for SQL Server in Delphi and C++Builder
Post Reply
sparkz
Posts: 9
Joined: Thu 15 May 2008 17:01

Problem with joined tables

Post by sparkz » Mon 17 Jun 2013 15:06

I'm using the latest version of the driver (6.2.3) and I have a problem with the driver - this is on Windows 7 and Delphi XE3.

I'm doing a query with TSQLDataSet (or TSQLQuery same result) with a straight forward joined table. e.g. SELECT * FROM A INNER JOIN B ON A.ID = B.ID WHERE A.xxx = xxx AND B.yyy = yyy

However, I keep getting SQL error 107, basically complaining about my second table B prefix table. There's nothing wrong with that of course.

Diving a bit deeper I found it's because I'm trying to get a RecordCount from the result set. If I take this out it's fine. Tracing through it seems it's something to do with the way the record count is obtained. It generates a new query with COUNT(*) instead of * and it seems to be this that's causing the problem.

Of course, the record count is not crucial and I can code around that. Any ideas on whether this is a bug or not and if so where?

Thanks
Mark

AndreyZ

Re: Problem with joined tables

Post by AndreyZ » Wed 19 Jun 2013 06:56

When you try to get the value of the RecordCount property of TSQLQuery or TSQLDataSet, the TCustomSQLDataSet.GetRecordCount method is executed. The problem you encountered is caused by this method, it generates the incorrect query for obtaining the record count. You should write about this problem to the Embarcadero support.

sparkz
Posts: 9
Joined: Thu 15 May 2008 17:01

Re: Problem with joined tables

Post by sparkz » Wed 19 Jun 2013 09:59

Ok, thanks.

AndreyZ

Re: Problem with joined tables

Post by AndreyZ » Wed 19 Jun 2013 10:08

If any other questions come up, please contact us.

Post Reply