Page 1 of 1

Some fields not getting written correctly

Posted: Sun 31 Jan 2016 18:18
by nszmnsky
The code below is not behaving as I thought it would. When this code runs, the [UpdateFN] and [SQL] fields remain null but [Applied] and [Status] get correct data. I know there is something in each of the variables, both since the LiteSQL1.Execute actually does its job and updates database AND because on debug I see correct text assigned to FN

Code: Select all

  UpdatesApplied.Open;                                 
  UpdatesApplied.Edit;
  UpdatesApplied.Append;
  FN:=extractfilename(SQL_FN);
  UpdatesApplied.FieldByName('UpdateFN').AsString:=quotedstr(FN);
  UpdatesApplied.FieldByName('SQL').AsString:=quotedstr(LiteSQL1.SQL.GetText);
  UpdatesApplied.Fieldbyname('Applied').AsDateTime:=Now();
  UpdatesApplied.Fieldbyname('Status').AsString:='PENDING';
  updatesapplied.Post;
Am I missing something? I'm really puzzled because the code below, which also executes on startup does correctly insert data into the table.

Code: Select all

         DBM.UpdatesApplied.Open;
         DBM.UpdatesApplied.Append;
         DBM.UpdatesApplied.FieldByName('UpdateFN').AsString:=extractfilename(Application.Title)+' '+VersionTxt;
         DBM.UpdatesApplied.FieldByName('SQL').AsString:=VersionTxt;
         DBM.UpdatesApplied.FieldByName('Applied').AsDateTime:=now();
         DBM.UpdatesApplied.FieldByName('Status').AsString:='1ST_RUN';
         DBM.UpdatesApplied.Post;

Re: Some fields not getting written correctly

Posted: Tue 02 Feb 2016 12:12
by MaximG
Please describe the issue in more details in order for us to investigate it. In addition, send us a small example that demonstrates the problem, including a test DB, to maximg*devart*com .