Re: Updating binary fields in MS SQL



Mike Shkolnik wrote:

For example, I set the parameter to 0x54657374 (that is, 'Test'),
and it
actually put into
the database 0x5400650073007400.
Look like unicode/widestring. How did you declare your parameter
(what type of param)?

It's a ftVarBytes. I managed to find a work-around (through a response
to my post in another NG), which is to load the blob using
LoadFromStream(stream, ftBlob) rather than using Value directly.

I'd still be interested in finding out why my initial approach didn't
work though. Could it be, as you suggest, that my parameter type is
wrong? The thing is, I didn't set the parameter type myself, it's done
automatically by ADO, I just happened to notice that
ADOCommand.Parameters.Items[i].DataType was ftVarBytes. So am I
supposed to override that when it's not right??

Actually, I've seen strange behaviour sometimes, where ADO is simply
unable to detect the data-type, and so it just gives up and says
dataType ftUnknown... I've already found another work-around for that
case, but if there's actually a valid explanation for this behaviour
I'd be very interested, as it would avoid having to resort to
guess-work. :)

I find ADO very frustrating...

Anyway, that's for your reply Mike!
--
Best regards,
Jonathan Neve
_______________
CopyTiger - advanced database replicator for Interbase/Firebird!
Web : http://www.microtec.fr/copycat/ct
_______________________________________
CopyCat - database replication components for Delphi/C++Builder!
Web : http://www.microtec.fr/copycat/cc
.