您的位置:首页 > 数据库

将一个图片文件转换为字节流存入数据库

2005-07-07 20:07 603 查看
1//将一个图片文件转换为字节流存入数据库
2string pictureFilePath = "";
3Byte[] bt;
4pictureFilePath = @"C:\temp.bmp";
5FileStream fs = new FileStream(pictureFilePath,FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
6
7bt = new byte[Int32.Parse(fs.Length.ToString())];
8
9fs.Read(bt,0,Int32.Parse(fs.Length.ToString()));
10
11
13sqlComm.Parameters.Add("@CMPicture",bt);
14
15
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐