SQL怎么样存储照片,用什么类型

用了image类型,然后怎么添加数据进去呢?

是image类型
sqlcom.Parameters.Add("@photo", SqlDbType.Image, photo.Length).Value = photo;
存储照片可以有好多种方法
方法一:把图片转换为二进制进行存储
方法二:把图片的图片的位置信息存储到数据库
............
参考代码:
public static byte[] GetPhoto(string filePath)
{
FileStream stream = new FileStream( filePath, FileMode.Open, FileAccess.Read);
BinaryReader reader = new BinaryReader(stream);

byte[] photoqq = reader.ReadBytes((int)stream.Length);

reader.Close();
stream.Close();

return photoqq;
}
温馨提示:答案为网友推荐,仅供参考
第1个回答  2011-12-24
用image类型就可以。
一般数据库中都只放照片的路径,照片都是另外存放在一起的。
相似回答