Watch, Follow, &
Connect with Us

Please visit our new home

Public Report
Report From: Delphi-BCB/Database/TField/TDateTimeField/TDateField    [ Add a report in this area ]  
Report #:  128080   Status: Resolved
[Regression] TField *Sender of OnValidate Event not Updated with DATE Type
Project:  Delphi Build #:  21.0.17017.3725
Version:    21.0 Submitted By:   Danilo Pinheiro
Report Type:  Basic functionality failure Date Reported:  10/3/2014 12:00:03 PM
Severity:    Serious / Highly visible problem Last Updated: 10/27/2014 6:14:14 PM
Platform:    All platforms Internal Tracking #:   55696
Resolution: Checked In (Resolution Comments) Resolved in Build: : None
Duplicate of:  None
Voting and Rating
Overall Rating: No Ratings Yet
0.00 out of 5
Total Votes: None
Using a TClientDataSet, with fields of DATE Type, the Validate Function has problem with parameter TField *Sender.
The Value is not updated.
Show old value.

My old version is XE3 and this not occurs
Steps to Reproduce:
Insert a TClientDataSet.
1. Insert a field DATE type.

2. Insert a field DATETIME type.

3. Link the field with OnValidate Event.

4. Insert a ShowMessage(Sender->AsString) and look the result.
void __fastcall TForm1::ClientDataSet1DATAValidate(TField *Sender)

void __fastcall TForm1::ClientDataSet1DATATIMEValidate(TField *Sender)

void __fastcall TForm1::ClientDataSet1AfterInsert(TDataSet *DataSet)

void __fastcall TForm1::Button1Click(TObject *Sender)
  ClientDataSet1->Post() ;

5. Build and run it, then click the button

The ShowMessage of Field Date result = 30/12/1899
The ShowMessage of Field DateTime result = 03/10/2014 15:56:36

This not occurs in XE3.

Tomohiro Takahashi at 10/4/2014 12:00:59 AM -
Could you please attach sample project to reproduce/confirm your issue?

and, is this issue a regression in XE7? What about previous versions of C++Builder?

Danilo Pinheiro at 10/6/2014 7:11:29 AM -
Sample is ok. How can i attach?

Tomohiro Takahashi at 10/6/2014 5:56:22 PM -
Please use Windows native QC client to attach sample project(as a .zip).
The standalone client(QualityCentral.exe) is included in Delphi.

Danilo Pinheiro at 10/7/2014 7:05:49 AM -

My old version is XE3 and this not occurs

Denilson Tribia at 1/15/2015 10:33:18 AM -
I have the same problem.
In XE6 works fine.

Denilson Tribia at 1/16/2015 3:59:23 AM -
Some methods were removed in XE7, sample:

procedure TDateTimeField.CopyData(Source, Dest: TValueBuffer);
  Move(Source[0], Dest[0], SizeOf(TDateTime));

procedure TDateTimeField.CopyData(Source, Dest: Pointer);
  TDateTime(Dest^) := TDateTime(Source^);

Vahid Namazi at 3/27/2015 1:25:01 PM -
moving from Delphi XE5 to XE7, we are facing the same problem.
apparently there is no fix available on XE7 according to Embarco.

Mitch Mullins at 7/6/2015 1:20:12 PM -
Just ran across this issue today.  Sure hope a fix is coming.

HDC Software Manager at 6/2/2015 7:41:10 AM -
We are facing the same problem, is there a fix in the meantime?

Chee Yang Chau at 9/17/2015 1:00:30 AM -
This problem still happen in RAD Studio 10 Seattle.

Predrag Zivanovic at 9/28/2015 6:36:28 AM -
   I have just discovered this bug and I cannot believe Embarcadero didn't resolve it yet. I patched with some workaround:

Unit Data.DB, procedure TField.CopyData, change from:

procedure TField.CopyData(Source, Dest: TValueBuffer);
  Move(Source[0], Dest[0], DataSize);


procedure TField.CopyData(Source, Dest: TValueBuffer);
  if FDataType = ftDate then
    Move(Source[0], Dest[0], SizeOf(TDateTime))
    Move(Source[0], Dest[0], DataSize);

   After a couple of hours of testing it looks like everything is OK. If anybody have some other solution, please share.

Guillaume BRIANCEAU at 11/5/2015 7:30:57 AM -
Personnaly, I have fixed the issue by altering TDateField.GetDataSize function (in Data.DB unit) from

function TDateField.GetDataSize: Integer;
  Result := SizeOf(Integer);


function TDateField.GetDataSize: Integer;
  Result := SizeOf(TDate);

I guess TTimeField should be fixed in a similar way.

Danilo Pinheiro at 6/24/2016 1:58:26 PM -
Hey Guillaume, Do you know how to reproduce this solution in C++Builder?



Server Response from: ETNACODE01