Quantcast
Channel: Embarcadero Community - Embarcadero Community
Viewing all articles
Browse latest Browse all 3212

Delphi 10.2 FireDac

$
0
0

 

Hi

Under Delphi XE6, I had a piece of code that went as follows:

 

   if FDQuery1.Locate('FarmerDetails',ComboBox2.Text+' '+IntToStr(YearOf(Now)),[])=True then

 

    FarmerID:=FDQuery1.FieldByName('ID').AsInteger

 

   else

 

    begin

 

    NewFarmer:=True;

 

    FDTable1.TableName:='"Neil"."MasterTable"';

 

    FDTable1.Open;

 

    FDTable1.Append;

 

    FDTable1.FieldByName('FarmerDetails').AsString:=ComboBox2.Text+' '+IntToStr(YearOf(Now));

 

    FDTable1.FieldByName('Consultant').AsInteger:=Consultant;

 

    FDTable1.Post;

 

    FarmerID:=FDTable1.FieldByName('ID').AsInteger;

 

    FDTable1.Close;

 

    end;

 

It worked fine. The ‘else’ statement appended a new farmer to the MasterTable database (IBM DB2). The column ‘ID’ was auto generated by DB2, and I retrieved that as FarmerID.

 

 

 

I moved everything to Delphi Tokyo 10.2 and have run into a problem. The identical code accessing the same database gives me an error.

 

Under the ’else’ statement, it now throws up an error saying Field ‘ID’ must have a value. It occurs during the append/post statements.

 

What has gone wrong?

Neil


Viewing all articles
Browse latest Browse all 3212

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>