0

I want to INSERT a byte array into a table (using C#). I've seen this: SqlParameterCollection.Add but I can't figure out how to use it - it doesn't seem to have a value parameter like AddWithValue does. (Perhaps there's some way to use AddWithValue with byte arrays?)

And the same goes for a SELECT - I want to SELECT a row WHERE ColumnX = MyByteArray. (The column contains binary).

So how is it done?

6
  • 3
    Possible duplication (there is code example there) : stackoverflow.com/questions/1955977/… Commented May 23, 2013 at 18:14
  • Virtually exact duplicate of the above link. Commented May 23, 2013 at 18:16
  • @cvraman Thanks. I don't know how I missed that. Commented May 23, 2013 at 18:16
  • Ha. Now that it's closed - SO doesn't allow me to delete my question. Commented May 23, 2013 at 18:19
  • @ispiro : Was my comment deleted or what ? Commented May 23, 2013 at 18:21

1 Answer 1

0

You can use paramete datatype VarBinary

Cmd.Parameters.Add("@ArrayValues", SqlDbType.VarBinary, 100).Value = YourArrayList;
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.