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

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
radub
Posts: 105
Joined: Sat 10 Jul 2010 18:46

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

Post by radub » Thu 16 Oct 2014 13:21

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.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

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

Post by AlexP » Fri 17 Oct 2014 08:26

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.

radub
Posts: 105
Joined: Sat 10 Jul 2010 18:46

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

Post by radub » Fri 17 Oct 2014 11:53

It Works!
Thank you!

Case closed.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

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

Post by AlexP » Fri 17 Oct 2014 12:00

Glad to see that the issue was resolved. If you have any further questions, feel free to contact us.

Post Reply