I want to add a image file to my database using sqldatasource .
steps that i have taken
1.Coverting image to Byte[] array.
Stream fs = FileUpload1.PostedFile.InputStream;
BinaryReader br = new BinaryReader(fs);
Byte[] bytes = br.ReadBytes((Int32)fs.Length);
2.Setting the update parameter type as Object
<UpdateParameters>
<asp:Parameter Name="File" Type="Object" />
</UpdateParameters>
3.Adding byte array as update parameter in SqlDataSource control.
sqlDataSource.UpdateParameters["File"].DefaultValue = bytes;
but when i compile this code it is giving me a error "is giving me a error
"Cannot Implicitly convert byte[] to string" at third step
Try to set parameter in Updating event
you should make data type varbinary
and made datatype varbinary(max) in your database