I have a table in SQL Server that has a number of columns. One of these columns is a varbinary(4000)
.
Essentially I need to take several rows in the table and use the values in the columns. This includes the varbinary(4000)
value. However I am having trouble passing the varbinary(4000)
value into a VB parameter.
I need to be able to pass it into a parameter (the parameter types doesn't matter as long as I can compare it to other varbinary(4000)
values (also taken from the same column in the DB)) and then send an update back to SQL Server a different table.
The varbinary(4000)
values is being used as our primary key so obviously the value has to be the same when SQL Server receives it again.
I have tried a few different things. I believe that the varbinary(4000)
value is a hexadecimal number.
TryCast(ds.Tables(0)("columnName"), System.Data.Linq.Binary).ToArray()
Encoding.UTF8.GetString(ds.Tables(0)("columnName"))
Encoding.Unicode.GetString(ds.Tables(0)("columnName"));
Encoding.ASCII.GetString(ds.Tables(0)("columnName"));
Edit
The possible duplication is not a solution because he simply needs to read the value from SQL. I need to compare it to other varbinary(4000)
in the table in order to use the varbinary(4000)
as a value in a sql insert command. Thus I need the varbinary(4000)
value to be the same as when I received it (if it needs to be converted in between that's fine).