By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,529 Members | 1,860 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,529 IT Pros & Developers. It's quick & easy.

updating blobs

P: n/a
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?

Jul 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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);

--
W.G. Ryan MVP (Windows Embedded)

TiBA Solutions
www.tibasolutions.com | www.devbuzz.com | www.knowdotnet.com
"JohnK" <Jo***@discussions.microsoft.com> wrote in message
news:50**********************************@microsof t.com...
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?

Jul 21 '05 #2

P: n/a
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.
--
"JohnK" <Jo***@discussions.microsoft.com> wrote in message
news:50**********************************@microsof t.com...
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?

Jul 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.