views:

12

answers:

1

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 accept 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

A: 

Handle the OnUpdating event of your sqlDataSource and set the value there.

matt-dot-net