在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
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 emp.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(); ------------------------------------------------------- 从数据库读图片到picturebox SqlConnection conn=new SqlConnection(@"data source=chenyuming2004VSdotNET;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; |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论