updating blobs

G

Guest

this is what I'm trying to do:

myActionQuery = "UPDATE MyTable SET " & _
", Data = " & mData & _
" Where ObjectID = " & mObjectID

where mData is an array of bytes

this is the error msg I'm getting:
Operator '&' is not defined for types 'String' and '1-dimensional array of
Byte'.

any suggestions?
 
W

W.G. Ryan eMVP

Well, the Easy way to do it is to Parameterize your query and - you can use
Binary or Image. Non paramaterized query are the work of the devil -
they're nothing but headaches

Byte[] b = new Byte[10000];

SqlParameter prm = new SqlParameter("@Whatever", SqlDbType.Binary);

prm.Value = b;

CommandObject.Paramaters.Add(prm);
 
N

Nick Malik [Microsoft]

you are trying to concatenate two different types using an operator that is
not defined for it.

Convert the array of bytes to a string first. Better yet, since you are
updating a blog, use a parameterized method, so that you can simply pass the
array directly to SQL (assuming this is SQL Server).

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top