updating blobs

  • Thread starter Thread starter Guest
  • Start date Start date
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?
 
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);
 
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?
 
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?
 
Back
Top