如何在gridview中显示来自SQL数据库(本地)的图像? [英] How to display image from SQL database (local) in gridview?

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

问题描述

您好b $ b

我正在使用包含4列(ID,姓氏,姓氏,profilepicture)的数据库。我已添加数据并希望在visual studio中的gridview中显示它们。



我添加了一个SqlDataSource,当我测试查询时会显示正确的数据。但是当我打开网站时,图片栏/数据没有显示!?!



我还试图添加一列并选择ImageField和数据库中的右列。但我不明白我应该在URL格式字符串字段中写什么?数据库中的数据类型是image



任何帮助?



[ ^ ]这是添加新列窗口,其中应该写入URL



我尝试了什么:



试图找到路径,但似乎无法正确连接!?

Hi
I am working with a database that contains 4 columns (ID, surname, lastname, profilepicture). I have added data and want to show them in gridview in visual studio.

I have added a SqlDataSource and the right data is shown when I "test query". But when i open the site, the picture-column/data is not shown!?!

I have also tried to "add a column" and selected "ImageField" and the right column from the database. But I dont understand what I should write in the field for "URL format string"?? The datatype in the database is "image"

Any help?

[^] Here is the "add new column" window where the URL is supposed to be written

What I have tried:

Tried to find the path, but cant seem to connect it right!?!

推荐答案

我个人不会将实际图像存储在我的数据库中 - 我会将图像存储在一个文件夹中,并将其存储在桌面上 - 在这种情况下,您可以将其放在字段中。但是,坚持你的方式,本文应该有所帮助:使用Gridview显示数据库中的图像 [ ^ ]
Personally I wouldn't store the actual image on my database - I would store the image in a folder and would just store it's location on the table - in which case you could just put that in the field. However, sticking with the way you have done it then this article should help:Using Gridview to display Images from Database[^]

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

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