I am trying to save an image from file upload control to a database
public Byte[] bytes;
Stream fs = FileUpload1.PostedFile.InputStream;
BinaryReader br = new BinaryReader(fs);
bytes = br.ReadBytes((Int32)fs.Length);
SqlDataSource2.Update();
protected void SqlDataSource2_Updating(object sender, SqlDataSourceCommandEventArgs e)
{
e.Command.Parameters["@project_file"].Value = bytes;
}
In my database project_fileis set varbinary(MAX),
but he gives an error
The parameter "@project_file" exceeds the size limit for the sql_variant data type.
Please suggest some solution.
source
share