comm.CommandText=
"insert into Images(Image, contentType) values(@image, @contentType)";
comm.CommandType=
CommandType.Text;
SqlParameter param=comm.Parameters.Add(
"@image", SqlDbType.Image);
param.Value=content;
似乎一定要采用参数形式
如何插入图片:
大致流程:其他图片格式--》image类型的转化--》到MemoryStream流的转换--》到二进制的转换--》插入到数据库。
如何得到图片:
大致流程:选取数据库中的image类型字段--》转化为二进制流--》转化为MemoryStream流--》转化为Image图片格式类型。
转载于:https://www.cnblogs.com/goto/archive/2012/04/26/2471533.html
相关资源:数据库中图片的二进制存储和显示