Page 1 of 1
BaseTableName for SQL Server fields
Posted: Sun 05 Aug 2012 15:58
by yeohray
In the OLEDBAccessUni unit, I see that there is a TOLEDBFieldDesc class that contains some interesting details about the returned fields. How can I access this data? I tried the following:
if qryMain.GetFieldDesc(qryMain.Fields[0].FieldName) is TOLEDBFieldDesc then
begin
ShowMessage(TOLEDBFieldDesc(qryMain.Fields[1]).BaseTableName);
end;
but the details are always empty.
Thanks in advance.
Re: BaseTableName for SQL Server fields
Posted: Mon 06 Aug 2012 08:47
by AndreyZ
Hello,
You cast TField to TOLEDBFieldDesc, it is incorrect. You should use the following code:
Code: Select all
if qryMain.GetFieldDesc(qryMain.Fields[0].FieldName) is TOLEDBFieldDesc then
ShowMessage(TOLEDBFieldDesc(qryMain.GetFieldDesc(qryMain.Fields[0].FieldName)).BaseTableName);
Re: BaseTableName for SQL Server fields
Posted: Mon 06 Aug 2012 15:50
by yeohray
Thanks, that was indeed a mistake on my part. However, I am still unable to get any values from the BaseTableName property.
Are there any conditions where Unidac will not retrieve these properties? My app is a multi-threaded app, and the connection components are placed on a data module, and server-specific data modules are inherited from this base data module e.g. a SQL Server data module will inherit from the base data module containing a TUniConnection and TUniQuery, with the addition of the SQL Server specific provider.
Thanks in advance.
Re: BaseTableName for SQL Server fields
Posted: Tue 07 Aug 2012 08:32
by AndreyZ
The BaseTableName property is filled with a value that is returned from SQL Server. If it is blank, it means that SQL Server doesn't return or cannot return the correct table name for the used SQL statement.