SQL Binary and C# byte[]

May 14 2007 8:51 AM
Hello,

I am having a problem with a binary field in SQL Server.

I need to be able to run some queries through a C# Application over 2 databases.

So I am basically reading in a binary data field and convert it to a byte[] datatype and then storing it on a table in a different database as a foreign key value.

However, when I run the query, the 2 values of binary data don't match and the query doesn't return any results...

I am reading the result set of the query in a DataSet from which I create a DataReader in order to be able to read and convert the binary data value.

byte[] uuid = (byte[])DataReader["uuid"];

After that I store it in a database by the use of an SQL Command object and a parameter of binary[] type.

After all this I am not able to associate records by the use of this field and when i run a simple Select command on sql server on both tables, the coded values are the same except from the last 2 digits...

Has anyone has a similar problem, or know of another way to do this?

Thanks in advance...

TedManowar

Answers (1)