如何从SQL Server检索图像数据到ASPX页面 [英] How to retrieve image data from sql server to aspx page

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

问题描述

你好朋友

我想将图像数据从sql server检索到aspx页面.
在我的aspx页面中,我正在使用图像控件,并且我希望此图像在此图像控件上.我将图像保存在sql服务器中,但无法将其检索到图像控件中.我还在应用程序中使用文件上传控件.

请帮我

Hello Friends

I want to retrieve image data from sql server to aspx page .
In my aspx page i m using a image control and I want this image on this image control. I m saving image in sql server but i can''t retrieve it into my image control. I m also using file upload control in my application.

Pls Help me out

推荐答案


开头
http://aspalliance.com/140 [ ^ ]
http://www.davidhayden.com/blog/dave/archive/2008/10/22/ASPNETWebsiteDevelopmentDisplayingImagesSQLServerDatabase.aspx [ ^ ]
Start with

http://aspalliance.com/140[^]
http://www.davidhayden.com/blog/dave/archive/2008/10/22/ASPNETWebsiteDevelopmentDisplayingImagesSQLServerDatabase.aspx[^]


在单独的aspx文件代码后面..
从数据库中获取Blob.如果将数据存储为base64字符串,则使用Convert.FromBase64String方法.它会给你字节数组.将此数组包装为二进制流,然后写入Response的输出流.

设置该aspx页面上的图像控件的图像URL.
In a separate aspx file code behind..
Get the blob from your database. If you stored the data as base64 string then use the Convert.FromBase64String method. It will give you the byte array. Wrap this array in to a binary stream and write to the Response''s output stream.

Set the image url for the image control this aspx page.


这篇关于如何从SQL Server检索图像数据到ASPX页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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