如何从SQL中检索图像 [英] How to retrieve image from SQL
本文介绍了如何从SQL中检索图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想存储&从数据库中检索图像。但我不想将该图像存储在项目文件夹中。如何在不使用项目中的图像文件夹的情况下检索图像..
我不想使用下面的代码。
我尝试了什么:
I want to store & retrieve image from database. But I don't want to store that image in the project folder.. How to retrieve image without using image folder in project..
I don't want to use the below code.
What I have tried:
string filename = FileUpload1.FileName;
string path = Path.GetExtension(filename);
FileUpload1.SaveAs(Server.MapPath("~/images/" + filename));
cmd.Parameters.AddWithValue("@images", "~/images/" + filename);
推荐答案
您可以将图像作为二进制数据保存到SQL Server数据库中,请参考从ASP.Net中的数据库保存和检索图像 [ ^ ]
You can save images as binary data into SQL Server database, please refer Save and Retrieve images from database in ASP.Net[^]
这篇关于如何从SQL中检索图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文