Using GetBytes with varbinary fields

  • Thread starter Thread starter Dan
  • Start date Start date
D

Dan

I'm storing a byte array in a varbinary field in a SQL
Server 2000 database, eg:

dim b() as byte = new byte() {1,2,3,4}

but when I attempt to retrieve the byte array (using
OdbcDataReader.GetBytes), my array contains different
information than what is stored.

When I query the field using query analyzer, the data
displayed is as I inserted. I believe that sql server
stores varbinary in hexadecimal format and when it comes
back to vb, it's obviously in a different, and unexpected
format.

Is there a mechanism to retrieve the exact data that was
inserted?

Thanks in advance.
 
Back
Top