Using tUniquery

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Posts: 2
Joined: Sun 17 Jan 2016 11:37

Using tUniquery

Post by vicens » Sun 17 Jan 2016 12:05

I'm trying to use the same tUniQuery object to get number of records after selecting a filter fields and later to retrieve all records in a dataset.
This would be the code to retrieve the number of records:

Code: Select all

cStr: = 'select nCodInm from' + form1.cDataBaseName + '. Dbo.Vista_pisos Where NhaB> =' + int (tbHabit.Value) .ToString; 
uQPisos.SQL.Text: = cStr; uQPisos.Open; 
lbNumReg.Text: = 'Total Pisos: = uQPisos.RecordCount. ToString;
Later try to use the same object (uQPisos) to retrieve all the fields and show them into a grid.

Code: Select all

cStr: = 'SELECT * FROM' + form1.cDataBaseName + '. dbo.Vista_pisos Where NhaB> =' + int (tbHabit.Value) .ToString; 

uQpisos.SQL.Text: = cStr; 
As you can see in the first case I use a single key field for the recovery of the total number of records trying be as fast as possible (select nCodInm from ...).
In the second case I need all fields to show (select * from ...)
The problem is that the query is not updated when I try to retrieve all fields and I get a single field (nCodInm).
I can use two differents tUniQuery objects for resolve it but I don't think that be a good solution.

Anyone can tell me why this happens and what would be the right way to do it ??

Thank you

Devart Team
Posts: 1001
Joined: Fri 11 Apr 2014 11:47
Location: Alpha Centauri A

Re: Using tUniquery

Post by azyk » Mon 18 Jan 2016 09:54

Please try to compose a small sample reproducing the described behavior and send it to andreyz*devart*com . Include script for creating the test table into the sample.

Post Reply