If the field types are the same in both tables, why not use .Value?
  Andrew.

>  -----Original Message-----
> From:         John Christenhusz [mailto:[EMAIL PROTECTED]] 
> Sent: Monday, 2 April 2001 4:38 p.m.
> To:   Multiple recipients of list database
> Subject:      [DUG-DB]:  Field Type
> 
> G'day all,
> 
> I've got this application requiring to copy paradox records from one table
> to another. By doing that, only a few fields need a special procedure to
> follow. I was thinking about using one loop as an index for the records to
> copy and within that loop a second loop to check for any of these special
> field. Something like the following code:
> 
> 
>     with tblMaster1 do
>     begin
>       i := 0;      
>       while not eof do
>       begin
>         for iField := 0 to fieldCount - 1 do
>           if (tblMaster1.fields[iField].fieldName = 'City') then
>             tblSlave1.fields[iField].asInteger := SpecialFunction1;
>           else
>           if (tblMaster1.fields[iField].fieldName = 'Address') then
>             tblSlave1.fields[iField].asInteger := SpecialFunction2;
>           else
>             // just a straight copy
>             tblSlave1.fields[iField].as? := fields[iField].as?; // how to
> solve this ?????
>         next;
>         application.processMessages;
>       end;
> 
> But as you can see from the code, the problem is that for the "normal"
> fields the filed type is unknown (as indicated in the example with 'as?'.
> Is there any way of finding out what field type the current field is and
> to use that in the instead of the fixed asString?
> Thus I was thinking along the line of:
> 
>   if tblSlave1.fields[iField].FIELDTYPE = Tstring then
>     tblSlave1.fields[iField].asString := fields[iField].asString else
>   if tblSlave1.fields[iField].FIELDTYPE = Tinteger then
>     tblSlave1.fields[iField].asInteger := fields[iField].asInteger else
>   if ... 
> 
> 
> Or is there any other way of doing this?
> 
> Thanks a lot for any help.
> 
> John.
> 
> 
---------------------------------------------------------------------------
  New Zealand Delphi Users group - Database List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

Reply via email to