如何在不使用mvc的情况下使用ASP.NET中的实体框架在数据库中插入/检索图像。 [英] How to insert/retrieve image in/from database using entity framework in ASP.NET without using mvc.
本文介绍了如何在不使用mvc的情况下使用ASP.NET中的实体框架在数据库中插入/检索图像。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想创建一个像facebook一样的用户个人资料页面,我想在用户登录时,用户可以上传他的个人资料图片。
我尝试了什么:
i尝试了这个,但它没有用。
使用EF和ASP.NET在SQL Server中监控图像 [ ^ ]
解决方案
图像作为字节数组存储在数据库blob字段中。所以这是一个Google Code with Code first&数据库优先(不知道您使用的EF方法)解决方案:在实体框架中使用blob - Google搜索 [ ^ ]。其中一个应该符合您的要求。
更新:这是一个由两部分组成的ASP.NET上传,保存和向/从DB加载图像(来自Google搜索):
*第1部分 - 将图像保存到数据库使用asp.net - YouTube [ ^ ]
*第2部分 - 从asp.net中的数据库加载图像 - YouTube [ ^ 一>
i want to create a user profile page just like facebook, in which I want when the user login,user can upload his profile picture.
What I have tried:
i tried this but it is not working.
Storing Images in SQL Server using EF and ASP.NET[^]
解决方案
Images are stored as byte arrays in database blob fields. So here is a Google Search with Code first & DB first (not knowing which EF approach you are using) solutions: working with blobs in entity framework - Google Search[^]. One of these should suit your requirements.
Update: here is a two-part video tutorial of ASP.NET uploading, Saving, and loading Images to/from DB (from above Google Search):
* part 1 - Save image to database using asp net - YouTube[^]
* Part 2 - Load image from database in asp net - YouTube[^]
这篇关于如何在不使用mvc的情况下使用ASP.NET中的实体框架在数据库中插入/检索图像。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文