Updating binary fields in MS SQL



Hi,

I'm using a TADOCommand to update a binary ("image") field in an MS SQL
table. I have an update statement with a parameter, and I set the
binary value to the parameter.

The trouble I have is that the binary data is getting deformed. After
every byte of binary data, a byte of 0s is inserted. For example, I set
the parameter to 0x54657374 (that is, 'Test'), and it actually put into
the database 0x5400650073007400.

Has anyone else ever had a problem like this, and do you have any idea
where it's coming from? Here's how I set my parameter:

ADOCommand.Parameters.Items[i].Value := NewVal;

where NewVal is a Variant, and in debug mode, I made sure it had the
correct value (i.e. 'Test').

After that, I do:

resultSet := ADOCommand.Execute(nRowsAffected, EmptyParam);

And I put the resultset into an ADODataSet (but of course, since here
I'm dealing with an update statement, this part has no effect).

Any ideas?
--
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
.



Relevant Pages

  • Problems with ADO and MS SQL...
    ... The trouble I have is that the binary data is getting deformed. ... And I put the resultset into an ADODataSet (but of course, ... I'm dealing with an update statement, ... CopyTiger - advanced database replicator for Interbase/Firebird! ...
    (borland.public.delphi.thirdpartytools.general)
  • Re: ResultSet.updateString against DB2 giving "Column not updatable"
    ... ResultSet rs=p.executeQuery; ... String oldValue=rs.getString; ... because if I do a select statement then an update statement, ... Check the driver documents about this. ...
    (comp.lang.java.databases)