Page 1 of 1

GetFieldDesc

Posted: Mon 09 Aug 2010 10:14
by radub
Hello,

I have used the TField method GetFieldDesc(FiledName).IsKey in SDAC to obtain the PK fields for a table (see http://www.devart.com/forums/viewtopic.php?t=18570), but looks like ODAC doesn't know about this function. In my ODAC v5.70 I have used KeyFields property with success, but after putting the 6.90 trial version, KeyFields returns wrong fields name; the property is empty, I didn't fill in anything.
I am using D6, Ora 10.2g, Win XP sp3.

Any help for retrieving PK with ODAC would be appreciated.

Thank you

Radu B.

Posted: Mon 09 Aug 2010 14:44
by bork
Hello

ODAC has the GetKeyList function that returns fields list in the primary key. But this function is case sensitive, so, table name should be defined in the upper case:

Code: Select all

var
  primary_keys: TStringList;
begin
  primary_keys := TStringList.Create;
  OraQuery1.GetKeyList('TABLE_NAME', primary_keys);
  ShowMessage(primary_keys.Text);
end;

Posted: Tue 10 Aug 2010 09:08
by radub
Thank you.

Posted: Tue 10 Aug 2010 09:08
by radub
Thank you.