转为byte类型后存入Image字段。
byte[] imagebytes=null;
FileStream fs=new FileStream(Image_path,FileMode.Open);
BinaryReader br=new BinaryReader(fs);
imagebytes=br.ReadBytes(br.Length);
SqlParameter parInput22=cmd.Parameters.Add("@员工图片",SqlDbType.Image);
parInput22.Direction=ParameterDirection.Input;
cmd.Parameters["@员工图片"].Value=imagebytes;
cmd.ExecuteNonQuery();
数据库中操作图片
How To Read and Write BLOB Data by Using ADO.NET with Visual C# .NET
http://support.microsoft.com/default.aspx?scid=kb;EN-US;309158
把任意类型的文件保存到SQL Server
http://dotnet.aspx.cc/ShowDetail.aspx?id=EY1XLDYV-PIDF-43LO-1WFL-FMY5ALE1F635
byte[] imagebytes=null;
FileStream fs=new FileStream(Image_path,FileMode.Open);
BinaryReader br=new BinaryReader(fs);
imagebytes=br.ReadBytes(br.Length);
SqlParameter parInput22=cmd.Parameters.Add("@员工图片",SqlDbType.Image);
parInput22.Direction=ParameterDirection.Input;
cmd.Parameters["@员工图片"].Value=imagebytes;
cmd.ExecuteNonQuery();
数据库中操作图片
How To Read and Write BLOB Data by Using ADO.NET with Visual C# .NET
http://support.microsoft.com/default.aspx?scid=kb;EN-US;309158
把任意类型的文件保存到SQL Server
http://dotnet.aspx.cc/ShowDetail.aspx?id=EY1XLDYV-PIDF-43LO-1WFL-FMY5ALE1F635
解决方案 »
- 接口不能包含字段
- 360进程进程管理器是怎么实现的。。急 、、、、
- C# 如何使用进度条?
- 请教各位,能否对axwebbrowser控件中显示的word文件进行修改,并存入数据库
- listbox用法的一点困惑,如何实现像QQ自动回复那样?
- Windows API与.NET Framework之间的关系??
- 添加一个记录,能否让其ID字段(char)自动递增,比如原来001,添加一条新的后,自动为002
- 怎样在一个form上动态显示一个label?
- c#中如何识别验证码,不要调用ocr的
- 如何调整Panel的线宽啊
- 如何在SQL语句里使用函数?如求平均、求和、计数等?
- C#如何实现在制定字符串中查找一个字符串的位置?
OleDbParameterCollection 仅接受非空的 OleDbParameter 类型对象,不接受 Byte[] 对象。
是怎么回事呀?
INSERT INTO picture(picturetile)VALUES(?)";