添加图片以访问数据库以显示正常运行的形式 [英] Adding a picture to access database to show in a functioning form

查看:71
本文介绍了添加图片以访问数据库以显示正常运行的形式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果有任何方法可以将图片添加到微软访问数据库中,以便在该数据库链接到aspx页面时显示在结果中? 我知道如何创建一个数据库,我知道如何将它连接到一个aspx页面/表单等,我已经得到了所有
的工作,只是不知道是否可以添加一个将显示在结果?

If there any way to add a picture to a microsoft access database so that it shows up in the results when that database is linked to an aspx page?  I know how to make a database and I know how to connect it to an aspx page/form etc, I have got all that to work, just dont know if its possible to add a picture that will show up in the results?

推荐答案

如果图像本身在数据库中,这就变得棘手了。您无法将图像放入网页。你必须引用它们,例如< img src ="链接到图像" />

If the image itself is in the database this gets tricky. You can't put images into a web page. You have to reference them such as <img src="link to the image" />

您需要的是另一个页面,其中绝对没有HTML代码。这个其他页面必须访问数据库,根据传递给它的一些信息获取图像,然后吐出图像并设置approrpriate响应头,以便浏览器
知道它是一个图像。你的图片html标签看起来像< img src =" imagehandler.aspx?imageid = PRIMARYKEY" />其中主键是带有图像的数据库行的主键。

What you'll need is another page with absolutely no HTML code in it. This other page must access the database, get the image based on some information you pass to it, then spit back the image and set the approrpriate response headers so that the browser knows it's an image. Your image html tags will look like <img src="imagehandler.aspx?imageid=PRIMARYKEY" /> where primary key is the primary key of the database row with the image.

以下是在VB.Net中完成的示例:
http://www.velocityreviews.com/forums/t78173-display-an-image-from-access-database。 html

Here is an example done in VB.Net: http://www.velocityreviews.com/forums/t78173-display-an-image-from-access-database.html

这个的响应类型是BMP,您需要将其更改为您的图像类型。例如JPG,PNG等。您还需要确保图像是Web友好的,因此BMP或TIFF将无法显示。

The response type for this one is BMP, you'll need to change it to your image type. such as JPG, PNG, etc.. You'll also want to make sure that the image is web friendly so a BMP or TIFF won't be acceptable for display.


这篇关于添加图片以访问数据库以显示正常运行的形式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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