如何在数据库中显示图像到Gridview(ASP.NET 2.0) [英] How to Display an image, from a DB, into the Gridview (ASP.NET 2.0)

查看:68
本文介绍了如何在数据库中显示图像到Gridview(ASP.NET 2.0)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,


我想知道如何将图像显示到Gridview(ASP.NET 2.0)

直接从DataBase中获取,不使用URL,如本文所述:
文章:

http://msdn.microsoft.com/library/de...idViewEx06.asp


我没有URL,我在DB中有二进制图像,就像表格中的字段Photo

Employees一样。 NWIND.MDB中的NWIND.MDB数据库。

任何提示?


谢谢,

自动。

解决方案

您创建一个从数据库中打开图像的aspx,更改

响应类型和response.write()图像。 (另一个选项是

常用的是使用HTTPHandler返回图像)


然后为此图像添加指向此aspx页面的链接好像这是一个正常的

图像。

http://www.aspfree.com/c/a/ASP.NET/R ... --C ---第二部分/

就是一个例子。


干杯,


Greg

" Auto" <金** @ Auto.com>在消息中写道

news:%2 **************** @ TK2MSFTNGP04.phx.gbl ...

你好,

我想知道如何将图像显示到Gridview(ASP.NET 2.0)中直接从DataBase中获取,而不是使用URL,如本文所述
文章:

http://msdn.microsoft.com/library/de...idViewEx06.asp

我没有URL,我有二进制图片在DB中,如表格Employees中的字段
Photo
。 NWIND.MDB中的NWIND.MDB DataBase。
任何提示?

谢谢,
自动。



http://www.asp.net/default.aspx?tabindex=5& tabid = 41

个人网络入门套件有一个http处理程序就是这样做的。您可以

下载入门套件并查看代码。


-

Swanand Mokashi

Microsoft认证解决方案开发人员(.NET) - 早期成就者

Microsoft认证应用程序开发人员(.NET)

http://www.dotnetgenerics.com/

DotNetGenerics.com - 关于Microsoft .NET的所有内容/>
技术......

http:// www .swanandmokashi.com /
http:// www。 swanandmokashi.com/HomePage/WebServices/

股票报价的主页,当日报价和星座网络服务

" Greg Young [MVP]" ; <博士************* @ hotmail.com>在消息中写道

新闻:%2 **************** @ TK2MSFTNGP05.phx.gbl ...

你创建从数据库打开图像的aspx,更改
响应类型和response.write()图像。 (另一个通常使用的选项是使用HTTPHandler返回图像)

然后为图像放置一个指向此aspx页面的链接,就像它是
正常形象。

nofollowhref =http://www.aspfree.com/c/a/ASP.NET/Retrieving-Images-from-a-Database- -C ---第二部分/target =_ blank> http://www.aspfree.com/c/a/ASP.NET/R ... - C---Part-II/
就是一个例子。

欢呼,

Greg

" Auto" <金** @ Auto.com>在消息中写道
新闻:%2 **************** @ TK2MSFTNGP04.phx.gbl ...

你好,

我想知道如何将图像显示到Gridview(ASP.NET
2.0)直接从DataBase中获取,而不是使用URL,如本文所述
文章:

http://msdn.microsoft.com/library/de...idViewEx06.asp

我没有URL,我有二进制图片在DB中,如表格Employees中的字段
Photo
。 NWIND.MDB中的NWIND.MDB DataBase。
任何提示?

谢谢,
自动。




< blockquote>感谢您的回答,但我不想要页面中的照片

(Response.BinaryWrite)我希望它在Gridview专栏中。


问候。

" Greg Young [MVP]" <博士************* @ hotmail.com>在消息中写道

新闻:%2 **************** @ TK2MSFTNGP05.phx.gbl ...

你创建从数据库打开图像的aspx,更改
响应类型和response.write()图像。 (另一个常用的选项是使用HTTPHandler返回图像)

然后为这个图像的aspx页面添加一个链接,好像它是
正常的形象。

http://www.aspfree.com/c/a/ASP.NET/R ... - C---Part-II/ 就是一个例子。

干杯,

Greg

" Auto" <金** @ Auto.com>在消息中写道
新闻:%2 **************** @ TK2MSFTNGP04.phx.gbl ...

你好,

我想知道如何将图像显示到直接从数据库中获取的Gridview(ASP.NET
2.0),而不是使用URL,如本文所述:

http://msdn.microsoft.com/library/de...idViewEx06.asp
我没有URL,我在数据库中有二进制图像,就像字段<表格雇员中的照片
NWIND.MDB中的NWIND.MDB DataBase。
任何提示?

谢谢,
自动。




Hello,

I would like to know how do display an image into a Gridview (ASP.NET 2.0)
taken directly from a DataBase, NOT using an URL, like described in this
article:

http://msdn.microsoft.com/library/de...idViewEx06.asp

I have NO URL, i have the binary image inside the DB, like the field "Photo"
in the table "Employees" of the "NWIND.MDB" DataBase.
Any hints?

Thanks,
Auto.

解决方案

You create an aspx that opens the image from the database, changes the
response type and response.write() the image. (Another option that is
commonly used is to use a HTTPHandler to return back the image)

You then place a link to this aspx page for your image as if it was a normal
image.

http://www.aspfree.com/c/a/ASP.NET/R...--C---Part-II/
is an example.

Cheers,

Greg
"Auto" <Au**@Auto.com> wrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...

Hello,

I would like to know how do display an image into a Gridview (ASP.NET 2.0)
taken directly from a DataBase, NOT using an URL, like described in this
article:

http://msdn.microsoft.com/library/de...idViewEx06.asp

I have NO URL, i have the binary image inside the DB, like the field
"Photo"
in the table "Employees" of the "NWIND.MDB" DataBase.
Any hints?

Thanks,
Auto.



http://www.asp.net/default.aspx?tabindex=5&tabid=41
Personal web starter kit has a http handler that does exactly that. You can
download the starter kit and look at the code.

--
Swanand Mokashi
Microsoft Certified Solution Developer (.NET) - Early Achiever
Microsoft Certified Application Developer (.NET)

http://www.dotnetgenerics.com/
DotNetGenerics.com -- anything and everything about Microsoft .NET
technology ...

http://www.swanandmokashi.com/
http://www.swanandmokashi.com/HomePage/WebServices/
Home of the Stock Quotes, Quote of the day and Horoscope web services
"Greg Young [MVP]" <Dr*************@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...

You create an aspx that opens the image from the database, changes the
response type and response.write() the image. (Another option that is
commonly used is to use a HTTPHandler to return back the image)

You then place a link to this aspx page for your image as if it was a
normal image.

http://www.aspfree.com/c/a/ASP.NET/R...--C---Part-II/
is an example.

Cheers,

Greg
"Auto" <Au**@Auto.com> wrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...

Hello,

I would like to know how do display an image into a Gridview (ASP.NET
2.0)
taken directly from a DataBase, NOT using an URL, like described in this
article:

http://msdn.microsoft.com/library/de...idViewEx06.asp

I have NO URL, i have the binary image inside the DB, like the field
"Photo"
in the table "Employees" of the "NWIND.MDB" DataBase.
Any hints?

Thanks,
Auto.




Thanks for the answer, but i don''t want the photo in the page
(Response.BinaryWrite) i want it in a Gridview column.

Regards.
"Greg Young [MVP]" <Dr*************@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...

You create an aspx that opens the image from the database, changes the
response type and response.write() the image. (Another option that is
commonly used is to use a HTTPHandler to return back the image)

You then place a link to this aspx page for your image as if it was a normal image.

http://www.aspfree.com/c/a/ASP.NET/R...--C---Part-II/ is an example.

Cheers,

Greg
"Auto" <Au**@Auto.com> wrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...

Hello,

I would like to know how do display an image into a Gridview (ASP.NET 2.0) taken directly from a DataBase, NOT using an URL, like described in this
article:

http://msdn.microsoft.com/library/de...idViewEx06.asp
I have NO URL, i have the binary image inside the DB, like the field
"Photo"
in the table "Employees" of the "NWIND.MDB" DataBase.
Any hints?

Thanks,
Auto.




这篇关于如何在数据库中显示图像到Gridview(ASP.NET 2.0)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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