GetColumns for SQL Server give no Columnnames back

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
itsds
Posts: 37
Joined: Mon 30 Apr 2007 10:38
Location: Germany - Bochum
Contact:

GetColumns for SQL Server give no Columnnames back

Post by itsds » Sun 03 Aug 2008 22:41

I need the Column and Indexnames from SQL Server and therefor I created a TDAMetadata - Object with TUniConnection.CreateMetaData.
I provided Restrictions with TABLE_SCHEMA and TABLE_NAME
MetadataKind to 'Columns' and Open does not return a Result.

Also getting TABLE - Names only Works if Scope is set to local but in this Case i Get Tables and View.

I See there is another Parameter TABLE_CATALOG what do I have to assign to this Restriction or leave it empty ?

Im Using SQL Server 2005 with native client installed.

Pls Help

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Tue 05 Aug 2008 11:37

Please, make sure that TUniConnection is connected to a valid database.
To get the list of columns, try to use the following code:

Code: Select all

  UniMetaData := UniConnection1.CreateMetaData;
  UniMetaData.MetaDataKind := 'Columns';
  UniMetaData.Restrictions.Values['TABLE_NAME'] := Tablename;
  UniMetaData.Open;

itsds
Posts: 37
Joined: Mon 30 Apr 2007 10:38
Location: Germany - Bochum
Contact:

Post by itsds » Fri 08 Aug 2008 10:30

The Error i made was to set TABLE_SCHEMA to the Database an i had to set TABLE_CATALOG for MS-SQL.
Now I get the Columns.
Everythings now ok.

Post Reply