Trouble with Key.Columns.Count in Delphi 5

From: Eugene V. Goldberg (egold_at_mts-nn.ru)
Date: 12/23/03


Date: Tue, 23 Dec 2003 23:01:53 +0300

Yes, i installed the ADOUpdatePack.

My code looks like the following:

  ConnectionString := 'Provider=SQLOLEDB.1;Password=dba;Persist Security
Info=True;User ID=sql;Initial Catalog=System;Data Source=CORE';
  FCatalog := CoCatalog.Create;
  FCataLog._Set_ActiveConnection(ConnectionString);

  Table := CoTable.Create;
  for i := 0 to FCatalog.Tables.Count - 1 do
    if CompareText('Companies', FCataLog.Tables[i].Name) = 0 then
    begin
      Table := FCatalog.Tables[i];
      Break
    end;
  for i := 0 to Table.Keys.Count - 1 do
  begin
    Key := Table.Keys[i];
    if Key.Type_ = adKeyPrimary then
    begin
      FieldName := '';
      for j := 0 to Key.Columns.Count - 1 do <<<<<<------------here is the
error
      begin
        if FieldName <> '' then
          FieldName := FieldName + ';';
        FieldName := FieldName + Key.Columns[j].Name;
      end;
      ShowMessage(FieldName);
    end
  end;
  Table := nil

Anybody knows why i cant use Key.Columns.Count? It just gives me error that
i cant use this property...

I know that table "Companies" has one primary key and i need to retrieve
columns
this key consists of...

Thanx,
Eugene.



Relevant Pages

  • NO_DATA error
    ... The sql returns value since i select primary key, ... i try to bind with combo box i get following error.. ... i cant see data. ...
    (microsoft.public.dotnet.framework.aspnet)
  • NO_DATA Error
    ... The sql returns value since i select primary key, ... i try to bind with combo box i get following error.. ... i cant see data. ...
    (microsoft.public.dotnet.framework.adonet)
  • Games.pl again
    ... Its no that i want to deliberately ignore the advice you proposed to me, its just that i almost never use primary key as text only as integers ... "Of course I cant stop you. ... And that would really bum me out ... But my job isnt to stop you, ...
    (comp.lang.perl.misc)
  • SQL Select and primary keys
    ... I should know this but I dont and cant find an answer via Google... ... If my table as a primary key bases on multiple fields and I do a ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Download Midi Files
    ... Apparently I cant import the file names without this.And ... OK, I redid them. ... Nil, it's great to see you working at the limit of your ability. ...
    (alt.guitar.beginner)