使用保存在sql db中的路径在c#窗体上显示图像 [英] display image on a c# form using its path which is saved in sql db
本文介绍了使用保存在sql db中的路径在c#窗体上显示图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用保存在SQL数据库中的路径在C#表单上显示图像.
首先,我将图像的路径保存在SQL数据库中.
I am trying to display an image on a C# form using its path which is saved in SQL database.
First I saved the path of the image in SQL database.
//upload
// open file dialog
OpenFileDialog open = new OpenFileDialog();
// image file path
lblPicture.Text = open.FileName;
//save
Personal person = new Personal();
var
_with1 = person;
_with1.myPicture = lblPicture.Text;
现在,我想使用单击搜索按钮时保存在SQL数据库中的路径在C#窗体上显示此图像.我尝试了此操作,但给出了错误.
Now I want to display this image on a C# form using its path which is saved in SQL database when a search button is clicked. I tried this but given an error.
//search button
string filePath = person.myPicture.ToString();
Image newImage = Image.FromFile(filePath);
_with3.imgPerson.Image = newImage;
请提供帮助.
Help needed please.
推荐答案
从CodeProject中检查此链接
如何使用C#加载/显示图像 [ ^ ]
简单图像幻灯片放映 [
check this links from CodeProject
How to Load/Display images with C#[^]
A Simple Image Slide Show[^]
Hope this will help you
这篇关于使用保存在sql db中的路径在c#窗体上显示图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文