arrays - UPDATE QUERY Image -


If I try to convert an image to an array and then run the update query and transmit the string to the transfected image In the matrix I get the error:

+ operator type 'string' and 'matrix' is not defined for the 1-byte size

The code is: new memorystream () DirectCast (picturebox1.image, botmap) .seave (ms currentFormat) image = ms.toArray () A:

  data1 = textbox data2 = textbox2 ms New SQL parameters ("@ data1", _ data1), new SQL parameters ("@ data2", data2), new SQL parameters ("@image", using the dim param) Image)} MCMD.CommentText = "update table column1 = '" + data1 + "', column2 '" + data1 +' '' '"MCMD" Parameters.ed ("@image", SQLDB type Verbari, 8000). Value = image  

How can I fix this?

As you are, image variable < / P>

  mcmd.parameters.add ("@image", SqlDbType.varbinary, 8000). Value = Image  

So instead of preparing your query by adding unsafe values ​​to SQL injection attacks; Use parameterized query with parameters pre-defined

  mcmd.commandText = "update table_name set column 1 = @ data1, column2 = @ data2, image = @image < / Code> 

Comments