如何从数据库中获取图像 [英] how to fetch images from database

查看:68
本文介绍了如何从数据库中获取图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何显示数据库中的图像..

how to show the images from database..

推荐答案

数据库中的图像只是二进制数据。在您的SQL数据类型中有一个特殊的数据类型 [ ^ ],图像(或二进制)。这用于存储此类数据,为此您可以将文件转换为二进制文件( FileStream [ ^ ]会帮助你在这一个)。然后再次检索相同的文件,您将使用流并通过提供元标记(image / jpg)将二进制数据转换回文件。



欲了解更多信息,请阅读 http://www.mikesdotnetting.com/article/148/save-and-retrieve-files-from-a-sql-server-ce-database- with-webmatrix [ ^ ]
Image in database is simply binary data. In your SQL data types there is a special data type[^], image (or binary). This is used to store such type of data, for this sake you would convert the file to binary (FileStream[^] would help you out in this one). Then to retrieve the same file again you would use the streams and convert the binary data back to file, by providing a meta tag ("image/jpg").

For more on this read, http://www.mikesdotnetting.com/article/148/save-and-retrieve-files-from-a-sql-server-ce-database-with-webmatrix[^]


看看这个:为什么我得到参数无效。我从数据库中读取图像时出现异常? [ ^ ]它可能会有所帮助。
Have a look at this: Why do I get a "Parameter is not valid." exception when I read an image from my database?[^] it may help.


这篇关于如何从数据库中获取图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆