怎样在Access数据库中存取图片? 不是图片路径,是OLE型的二进制图片数据。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 把图片读到pictureBox,再写入数据库SqlConnection conn=new SqlConnection(@"data source=chenyuming2004\VSdotNET;uid=sa;pwd=cym;database=lhf");conn.Open();SqlCommand cmd=new SqlCommand("insert into fuser values ('1a','1b',@i)",conn);byte[] ib=new Byte[60000];FileStream fs=new FileStream(@"D:\windows temp\temp\1.jpg",FileMode.Open ,FileAccess.Read );fs.Read(ib,0,60000);cmd.Parameters.Add("@i",SqlDbType.Image,(int)fs.Length);cmd.Parameters["@i"].Value=ib;cmd.ExecuteNonQuery();conn.Close();-------------------------------------------------------从数据库读图片到pictureboxSqlConnection conn=new SqlConnection(@"data source=chenyuming2004\VSdotNET;uid=sa;pwd=cym;database=lhf");conn.Open();SqlCommand cmd=new SqlCommand("select 照片 from fuser where password='1b'",conn);SqlDataReader reader=cmd.ExecuteReader();reader.Read();MemoryStream buf=new MemoryStream((byte[])reader[0]);Image image=Image.FromStream(buf,true);pictureBox1.Image=image; 怎么获取当前路径和Windows文件夹的路径 C#中的webBrowser控件,如何让它点击所有链接都是在当前窗口打开! 工具箱中怎么添加dockpanel控件? [C#]如何让窗口最小化到系统托盘(右下角的小图标)??? 往access数据库中插入数据 如何实现把word文档显示在winform窗体中 简单问题,如何得到用程序打开的当前word的路径 招聘软件工程师 c#中如何解决不同进程访问同一文本 接口到底起什么用? 问一个关于网络的奇怪问题!!!急急急... 请教中文乱码问题
conn.Open();
SqlCommand cmd=new SqlCommand("insert into fuser values ('1a','1b',@i)",conn);
byte[] ib=new Byte[60000];
FileStream fs=new FileStream(@"D:\windows temp\temp\1.jpg",FileMode.Open ,FileAccess.Read );
fs.Read(ib,0,60000);
cmd.Parameters.Add("@i",SqlDbType.Image,(int)fs.Length);
cmd.Parameters["@i"].Value=ib;
cmd.ExecuteNonQuery();
conn.Close();-------------------------------------------------------
从数据库读图片到pictureboxSqlConnection conn=new SqlConnection(@"data source=chenyuming2004\VSdotNET;uid=sa;pwd=cym;database=lhf");
conn.Open();
SqlCommand cmd=new SqlCommand("select 照片 from fuser where password='1b'",conn);
SqlDataReader reader=cmd.ExecuteReader();
reader.Read();
MemoryStream buf=new MemoryStream((byte[])reader[0]);
Image image=Image.FromStream(buf,true);
pictureBox1.Image=image;