Board index » delphi » Invalid index descriptor

Invalid index descriptor

Hi,
Can anyone tell me what's wrong with these codes below...
I'm creating .dbf table on the fly from data in TQuery.

    BackupTable:= TTable.Create(Self);
    With BackupTable do
    begin
       DatabaseName:= 'dbBackup';
       TableName:= MyPath;
       With FieldDefs do
       begin
         clear;
         For MyCount:= 0 to qryBackupTrx.FieldCount -1 do
         begin
           Add(qryBackupTrx.Fields[MyCount].FieldName,
               qryBackupTrx.Fields[MyCount].DataType,
               qryBackupTrx.Fields[MyCount].Size,false);
         end;////with MyCount
       end;////With FieldDefs
       With IndexDefs do
       begin
         Clear;
         Add('TRX_DATE','TRX_DATE',[]);
         Add('TRX_NO','TRX_NO',[]);
         Add('TRX_TRX','TRX_DATE+TRX_NO+RECNO',[ixUnique, ixExpression]);
       end;
     End;
     BackupTable.CreateTable;
     BackupTable.Close;

I get "Invalid Index descriptor".
I want TRX_TRX to be unique indexed.
I am please to get alternative mathod or sugesstion.

Thanks in advance
Regards
KKGian

 

Re:Invalid index descriptor


You are mixin diferent data types in 'TRX_TRX' index.

KK Gian escribi en mensaje <7mk1g1$4...@forums.borland.com>...

Quote
>Hi,
>Can anyone tell me what's wrong with these codes below...
>I'm creating .dbf table on the fly from data in TQuery.

>    BackupTable:= TTable.Create(Self);
>    With BackupTable do
>    begin
>       DatabaseName:= 'dbBackup';
>       TableName:= MyPath;
>       With FieldDefs do
>       begin
>         clear;
>         For MyCount:= 0 to qryBackupTrx.FieldCount -1 do
>         begin
>           Add(qryBackupTrx.Fields[MyCount].FieldName,
>               qryBackupTrx.Fields[MyCount].DataType,
>               qryBackupTrx.Fields[MyCount].Size,false);
>         end;////with MyCount
>       end;////With FieldDefs
>       With IndexDefs do
>       begin
>         Clear;
>         Add('TRX_DATE','TRX_DATE',[]);
>         Add('TRX_NO','TRX_NO',[]);
>         Add('TRX_TRX','TRX_DATE+TRX_NO+RECNO',[ixUnique, ixExpression]);
>       end;
>     End;
>     BackupTable.CreateTable;
>     BackupTable.Close;

>I get "Invalid Index descriptor".
>I want TRX_TRX to be unique indexed.
>I am please to get alternative mathod or sugesstion.

>Thanks in advance
>Regards
>KKGian

Other Threads