sqldatasource - UpdateParameters with image byte array
This is how you set the defaultValue with a string:
sqlDataSource.UpdateParameters["Active"].DefaultValue = tbActive.Text;
How do you do something similar to the code below so that my sqlDataSource
can ac开发者_运维技巧cept an updated image?
FileUpload fuRoom1 = (FileUpload)gvRoom.Rows[e.RowIndex].FindControl("UploadedFile11");
byte[] imageData1 = new byte[fuRoom1.PostedFile.InputStream.Length + 1];
fuRoom1.PostedFile.InputStream.Read(imageData1, 0, imageData1.Length);
sqlDataSource.UpdateParameters["Image1"].DefaultValue = imageData1;
//<--wont work because it's not a string any ideas?
I have to save an image into a SQL database as datatype Image from the RowUpdating
event of a gridView. I have a FileUpload control in an EditItemsTemplate
Handle the OnUpdating event of your sqlDataSource and set the value there.
精彩评论