Click here to Skip to main content
15,885,869 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
am a Delphi beginner and are having a problem saving a TimeEdit value to a field that is an integer.The OnGetText procedure works but the OnSetText procedure is not updating the integer field in the database.This is what i have tried so far

What I have tried:

Delphi
procedure TForm1.TesttimeTableTimeStartGetText(Sender: TField; var Text: string;
  DisplayText: Boolean);
begin
  Str((Sender.AsInteger/60):6:2,Text);
end;




Delphi
procedure TForm1.TesttimeTableTimeStartSetText(Sender: TField;
  const Text: string);
Var TempStr  : String;
     TempVal  : LongInt;
     TempTExt : String;
begin
 TempText := Text;
 while Pos(' ', TempText) > 0 do
    TempText[Pos(' ', TempText)] := '0';
 if Pos(':',TempText) > 0 then
   begin
    TempStr := Copy(TempText,1,Pos(':',TempText));
    TempVal := StrToInt(Copy(TempText,Pos(':',TempText)+1,length(TempText) - Pos(':',TempText)));
    TempVal := TempVal + (StrToInt(TempStr)*60);
   end
  else
   begin
    TempVal := StrToInt(TempText)*60;
   end;
 Sender.AsInteger := TempVal;
end;
Posted
Comments
Richard MacCutchan 17-May-20 4:01am    
Where is the code that is supposed to update the database?
gerhardlouis 17-May-20 5:06am    
I apologise.I failed to mention that i am using the FireDac UDC with a binding navigator.I created a test db with one table and two fields
Richard MacCutchan 17-May-20 5:17am    
Sorry, I have no knowledge of that.
gerhardlouis 17-May-20 5:24am    
I appreciate your time to try and help me.
[no name] 17-May-20 11:16am    
"is not updating the integer field in the database": Do you call "Post" of the query?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900