本文介绍了保存并在/从mysql Windows应用程序中检索图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好..
我想将图片从picturebox/mysql保存/获取到mysql/picturebox
我可以将映像存储到mysql中. Lemme tel u一件事是,保存后我检查图像是否以字节格式保存.而且我无法取回它.
我为获取图像所做的是..
Hello..
I want to save/fetch image from picturebox/mysql to mysql/picturebox
I''m able to store the image into mysql. Lemme tel u one thing is, after saving i checked that image is saving in bytes format. Moreover im unable to fetch it back.
What i did to fetch the image is ..
con.Open();
MySqlCommand da=new MySqlCommand("select smn_pho from smn where smn_nme=''testing''",con);
MySqlDataReader ds = da.ExecuteReader();
DataTable dt = new DataTable();
dt.Load(ds);
using (MemoryStream ms = new MemoryStream((byte[])dt.Rows[0]["smn_pho"]))
{
ms.Position = 0;
ms.Seek(0, SeekOrigin.Begin);
pictureBox2.Image = System.Drawing.Image.FromStream(ms);//Throwing error at this location as Parameter not found...
ms.Flush();
ms.Close();
}
推荐答案
这篇关于保存并在/从mysql Windows应用程序中检索图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!