Page 1 of 1

AsBlob parameter is not the same in Delphi XE5 as in Delphi 7

Posted: Thu 16 Oct 2014 13:21
by radub
Hello,

Delphi 7 vs Delphi XE5 both with SDAC 6.11.23

In Delphi 7 the assignment of a string to an AsBlob parameter in a query, generates the following statement:

Code: Select all

exec sp_executesql N' update APPUSER set 
USERPASS=@P1 
 where USERID=1',N'@P1 varbinary(8000)',0x675D7E70C76B56234B7A293E251CDB6C7AE3A0397BA8C5A391
which works.

In Delphi XE5 I am not able to make the same assignment, the compiler throwing the error:
"Incompatible types: 'System.TArray<System.Byte>' and 'string'.

Any clue?

Thank you,
Radu B.

Re: AsBlob parameter is not the same in Delphi XE5 as in Delphi 7

Posted: Fri 17 Oct 2014 08:26
by AlexP
Hello,

The AsBlob property has a type TBlobData, Up to Delphi 2009, this type was declared as string, since Delphi 2009 - TBytes. You get a corresponding error due to this when attempting to assign a string to TBytes. If you want to assign a string to a BLOB parameter, you should use the property ParamByName('ParamName').AsBlobRef.AsString.

Re: AsBlob parameter is not the same in Delphi XE5 as in Delphi 7

Posted: Fri 17 Oct 2014 11:53
by radub
It Works!
Thank you!

Case closed.

Re: AsBlob parameter is not the same in Delphi XE5 as in Delphi 7

Posted: Fri 17 Oct 2014 12:00
by AlexP
Glad to see that the issue was resolved. If you have any further questions, feel free to contact us.