Add fields at runtime
Posted: Tue 05 Aug 2008 10:11
Hi.
I'm using the latest UniDac for MySQL and SQL Server with RAD 2007 Win32.
I've this problem:
I write a SQL.Text query in TUniQuery, like say:
select * from Customers order by name.
My program at runtime executes the query and TUniQuery automatically creates the fields corresponding to the Customers table.
Now I want to add a calculated (or in-memory) field to the TUniQuery.
The istruction Fields.Add raise an exception saying that this operation is not allowed with an open dataset.
So I tried to create the calculated field before opening the query.
But in this way when I open the TUniQuery, it does not automatically create the fields of the Customer's table.
So after beeing opened, the TuniQuery has only one field, the calculated one.
How can I solve this problem?
Thanks
NOTE: I cannot know the fields of the table Customers before have opened it.
I'm using the latest UniDac for MySQL and SQL Server with RAD 2007 Win32.
I've this problem:
I write a SQL.Text query in TUniQuery, like say:
select * from Customers order by name.
My program at runtime executes the query and TUniQuery automatically creates the fields corresponding to the Customers table.
Now I want to add a calculated (or in-memory) field to the TUniQuery.
The istruction Fields.Add raise an exception saying that this operation is not allowed with an open dataset.
So I tried to create the calculated field before opening the query.
But in this way when I open the TUniQuery, it does not automatically create the fields of the Customer's table.
So after beeing opened, the TuniQuery has only one field, the calculated one.
How can I solve this problem?
Thanks
NOTE: I cannot know the fields of the table Customers before have opened it.