Assign byte[] to sqldatasource.insertparameter.
-
Hi, I have a formview that uses a sqldatasource. In the insert item template of the formview I have a file upload control that the user uses to upload an image to the database. Then on the click event of the insert button I take the image and push it over to a byte array so that I can insert it into the database. Then I want to update the insert sqlparameter with the byte array to be saved to the database. The problem that I'm facing is that the column type in the database table is that of image, but when i try to set the sqltype of the insert parameter there is no image option under the TypeCode enum. I can't insert the image as string nor as object cause it gives me an sqlexcpetion of converting from string to image type. The error is as follow : "Operand type clash: nvarchar is incompatible with image" Any ideas on how to get this working? Thanks in advance
No matter how long he who laughs last laughs, he who laughs first has a head start!
-
Hi, I have a formview that uses a sqldatasource. In the insert item template of the formview I have a file upload control that the user uses to upload an image to the database. Then on the click event of the insert button I take the image and push it over to a byte array so that I can insert it into the database. Then I want to update the insert sqlparameter with the byte array to be saved to the database. The problem that I'm facing is that the column type in the database table is that of image, but when i try to set the sqltype of the insert parameter there is no image option under the TypeCode enum. I can't insert the image as string nor as object cause it gives me an sqlexcpetion of converting from string to image type. The error is as follow : "Operand type clash: nvarchar is incompatible with image" Any ideas on how to get this working? Thanks in advance
No matter how long he who laughs last laughs, he who laughs first has a head start!
images are binary type so you can do this by binary format