Board index » delphi » Need some help with Paradox tables

Need some help with Paradox tables

I have to create a Paradox table with the following criteria:

1 Primary Index
1 Composite Unique Secondary Index

I need to do this in code. I have Ver 5.0 of the BDE and am working
with Delphi 3.02.

HOW can I accomplish this in code? I know how to create tables in
Delphi and I can create indexes, etc but the composite, unique is
throwing me for a loop.

Thanks anyone, for your help!

----
Bill
------------------------
arte...@worldnet.att.net
barte...@neri.org
Programmer / Analyst
New England Research Institutes

"The two rules for success in life are:
        1) Never tell them everything you know."

             <?>

           \\\|///
          \\ ~ ~ //
           ( @ @ )
/-------oOOo-(_)-oOOo--------\

 

Re:Need some help with Paradox tables


Quote
Bill Artemik wrote:

> I have to create a Paradox table with the following criteria:

> 1 Primary Index
> 1 Composite Unique Secondary Index

> I need to do this in code. I have Ver 5.0 of the BDE and am working
> with Delphi 3.02.

> HOW can I accomplish this in code? I know how to create tables in
> Delphi and I can create indexes, etc but the composite, unique is
> throwing me for a loop.

I think:

MyTable.AddIndex('','DbYear;DbMonth;DbDate;',[]);

Should do it ...

Rkr

--
                   \|||/
                   /'^'\
                  ( 0 0 )
--------------oOOO--(_)--OOOo--------------
. Reid Roman                              .
. Delphi Programmer / Analyst             .
. TVisualBasic:=class(None);              .
. May the Source be With You              .
-------------------------------------------
. Auto-By-Tel (http://www.autobytel.com)  .
. Irvine, CA U.S.A                        .
. E-Mail : rkroman (at) pacbell (dot) net .
. or reidr (at) autobytel (dot) com       .
-------------------------------------------

Re:Need some help with Paradox tables


Bill,

var T: TTable;
begin
T:= TTable.create(nil); // this creates an in-memory Object
try T.TableName:= 'whatever';
     T.TableType:= ''ttParadox';
     T.DataBaseName:= 'folderOfYourChoice or Alias of your choice';
// now add the fields
     T.FieldDefs.clear;
     T.FieldDefs.Add({appropriate details here});
     // etc - add all fields with T.IndexDefs.Add();
// now add the indices
// add the primary index first
// the primary index's fields must be field 1 then field 2 etc up to the
number of fields
// you want the primary index to have each separated by semicolons
// the option parameter must specify ixPrimary
     T.IndexDefs.clear;
     T.IndexDefs.Add('IndexName', 'fieldname1;Fieldname2', [ixPrimary]);
// now add the secondary index
     T.IndexDefs.Add('NewIndex', 'CustNo;CustName', [ixUnique]);
// now to create the physical tabel on disk...
     T.CreateTable;
// if you want you can now use the table...
     T.open;
     T.insert;
     T.Fields[0].value:= 'xxx';
     T.post;
     T.close;

finally T.free; end;
end;

HTH,

Paul Motyer
SoftStuff
PO Box 637, Croydon, VIC, Australia, 3136

Quote
Bill Artemik wrote in message <3635ec09.86747...@news3.newscene.com>...
>I have to create a Paradox table with the following criteria:

>1 Primary Index
>1 Composite Unique Secondary Index

>I need to do this in code. I have Ver 5.0 of the BDE and am working
>with Delphi 3.02.

>HOW can I accomplish this in code? I know how to create tables in
>Delphi and I can create indexes, etc but the composite, unique is
>throwing me for a loop.

>Thanks anyone, for your help!

>----
>Bill
>------------------------
>arte...@worldnet.att.net
>barte...@neri.org
>Programmer / Analyst
>New England Research Institutes

>"The two rules for success in life are:
>        1) Never tell them everything you know."

>             <?>

>           \\\|///
>          \\ ~ ~ //
>           ( @ @ )
>/-------oOOo-(_)-oOOo--------\

Other Threads