c# - Cannot show the images of a particular user -


I am working in asp.net and I want to show a picture of the user whose profile_id is 1. I am saving pictures directly in the varbinary format in the database and retrieving it in gridview. The problem I am experiencing is that when a user logs in to the "View Photos" button and clicks one, then The picture itself is four times, when the user has uploaded 4 separate pictures, it is not taking all the four pictures that the user has uploaded. I am using this handler.

This is my table specification: Name of the table: (photo) column: photo_id, profile_id (foreign key), photo

Below is my grid-view code

  & lt; Asp: image id = "image 1" run = "server" imageUrl = '& lt;% #' ThumbNail.ashx? Proid = "+ Eval (" Profile_ID ")%> height =" 200px "width =" 200px "/>   

In this way I am binding data to the grid SqlConnection connection = New SqlConnection (strCon); SqlCommand command = new SqlCommand ("SELECT Photo_ID, [Photo] from Profile_ID where Profile_ID =" + session ["Profile"], connection); SqlDataAdapter Daimages = New SqlDataAdapter (command); Datatable DT = New DataTable (); daimages.Fill (DT); gridview.DataSource = dt; gridview.DataBind ();

and this handler Coding where I am doing the main thing to retrieve images

  String Peg = Reference. Request    

It appears that both the Photo_ID and Profile_ID , but you are using Profile_ID in the handler

I have a handle Will use Photo_ID as the parameter in R,

  & lt;% # 'thumbnail.hex? Photoid = "+ Eval (" Photo_ID ")%> height =" 200px "width =" 200px "/>   

and update the handler on it.

  string pd = context .Jquery string ["photoid"]; string query = "select photo from photo where photo_ID =" + pid;    

Comments

Popular posts from this blog

c++ - ERROR: cannot open source file x11\xlib.h -

c - What are pthread cancelation points used for? -

c# - Show a huge number of data in DevExpress GridView -