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'.

I'm using a reader to get the data....but now I need to update it... Using
dataset/datarow is not an option...

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);
 
G

Guest

Can I mix?
where I have some are like:
"SET
Fld1 = " & mFld1 & ", Fld2 = " & mFld2 & ", mData = @BinData "

we are using Access if that makes a difference, not SQL server...


W.G. Ryan eMVP said:
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 said:
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'.

I'm using a reader to get the data....but now I need to update it... Using
dataset/datarow is not an option...

Any suggestions?
 
W

W.G. Ryan eMVP

You can mix but you don't want to . Use ? instead of @whatever for OleDb.
Set blah = ? , blah2 = ? etc.

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

TiBA Solutions
www.tibasolutions.com | www.devbuzz.com | www.knowdotnet.com
JohnK said:
Can I mix?
where I have some are like:
"SET
Fld1 = " & mFld1 & ", Fld2 = " & mFld2 & ", mData = @BinData "

we are using Access if that makes a difference, not SQL server...


W.G. Ryan eMVP said:
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 said:
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'.

I'm using a reader to get the data....but now I need to update it... Using
dataset/datarow is not an option...

Any suggestions?
 

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