开发者

sqldatasource - UpdateParameters with image byte array

开发者 https://www.devze.com 2023-01-07 21:46 出处:网络
This is how you set the defaultValue with a string: sqlDataSource.UpdateParameters[\"Active\"].DefaultValue = tbActive.Text;

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消