Click here to Skip to main content
14,735,910 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
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

select img from tblUser where userId= @userId

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: , Sql server 2008
Sandeep Mewara 21-Oct-12 3:10am
What about WHERE clause? How is it affecting your implementation? WHERE clause will just filter few images.
a1mimo 21-Oct-12 17:03pm
I dont get what you want very clear do you want for example when you click on a record the image display in the image control or you want all the images to appear in images control beside the records?
Varun Sareen 22-Oct-12 2:59am
Dear Friend,

In order to show the images from the database you can't put them into a dataset object as that works in disconnected mode but for a image data type (which is is a stream); you have to use the datareader object and then converting the byte form into image you can then bind it to your image control.


Varun Sareen

1 solution

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

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900