I had a code like this in Delphi 7:
var
mValueBuffer : TValueBuffer;
begin
Double(MValueBuffer) := Date;
end;
When I compile this in Delphi 10 Seattle it fails with an invalid typecast error. I am using the Data.DB
unit.
I had a code like this in Delphi 7:
var
mValueBuffer : TValueBuffer;
begin
Double(MValueBuffer) := Date;
end;
When I compile this in Delphi 10 Seattle it fails with an invalid typecast error. I am using the Data.DB
unit.
Having extracted the information from your comments, and edited the question to use them, we can now make sense of this question. Please heed the advice given in the comments for future questions.
The type TValueBuffer
is declared in Data.DB
as a dynamic array of byte. As such, the type cast is invalid. You cannot hope to cast a dynamic array, essentially a pointer, to a double precision floating point value. These types are different sizes. Hence the compiler error. Even if the types were the same size, the cast makes no sense at all.
Why did this compile in Delphi 7. Well, the Delphi 7 standard libraries do not have a type named TValueBuffer
. So we can only presume that TValueBuffer
is defined in either your code, or libraries that you use. Presumably, your uses of the Data.DB
unit hides the TValueBuffer
type that was intended to be used. Find that type and you will have the answer to your problem.