Page 1 of 1

Using tUniquery

Posted: Sun 17 Jan 2016 12:05
by vicens
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.Close; 
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.Close; 
uQpisos.SQL.Text: = cStr; 
ClientModule1.uQPisos.Open;
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

Re: Using tUniquery

Posted: Mon 18 Jan 2016 09:54
by azyk
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.