【发布时间】:2011-09-28 17:35:07
【问题描述】:
我正在尝试将图像从文件上传控件保存到数据库中
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;
}
我的数据库project_file字段设置为varbinary(MAX),
但它会抛出错误
参数“@project_file”超出了 sql_variant 数据类型的大小限制。
请提出一些解决方案
【问题讨论】:
-
您缩进代码的方式是……很有创意。 ;-)
标签: c# asp.net sql visual-studio