从数据库检索图像并进行绑定 [英] retrieving image from database and binding

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

问题描述

我正在尝试将图像绑定到数据列表中的图像控件,没关系:)但问题是我想根据where子句检索图像

例如

i am trying to bind image to image control in datalist, thats ok :) but the problem is that i want to retrieve images on basis of where clause

e.g

select img from tblUser where userId= @userId


所以现在让我们假设我用这些记录填充了我的数据集,但是如何将这些检索到的图像绑定到图像控件,尤其是当检索到的记录大于1时.

工具:ASP.net(c#),Sql server 2008


so now lets suppose i filled my dataset with these reocrds but how to bind these retrieved images to image control, especially when records retrieved are more than 1,

TOOLS: ASP.net(c#) , Sql server 2008

推荐答案

将图像保存在数据库var binary(max)字段中,然后从数据库中检索该图像并保存在服务器和将特定路径绑定到网格视图
或将图像路径保存到数据库并直接绑定该图像路径
Save image in database var binary(max) field and then retrieve that from database and save on server and bind the specific path to grid view
or save image path to database and bind that image path directly


这篇关于从数据库检索图像并进行绑定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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