how to insert images to db then how to bind image field.

Posted by Jayakumars under ASP.NET on 10/14/2011 | Points: 10 | Views : 1104 | Status : [Member] [MVP] | Replies : 1
I am doing image insert to db and retrieve them. I am inserted byte for images
like this

My Insert Code

int length = FupImage.PostedFile.ContentLength;
byte[] imgbyte = new byte[length];
HttpPostedFile img = FupImage.PostedFile;
img.InputStream.Read(imgbyte, 0, length);
cmd.Parameters.Add(new SqlParameter("@StdImagePath", SqlDbType.Image)).Value = imgbyte;

How to populated the image field

my code below but did not bind them plz change the code but this is not working

SqlCommand command = new SqlCommand("select StdImagePath from Tbl_StudentsProfile where StudentID=" + autoID +"", con);
SqlDataReader dr = command.ExecuteReader();

Mark as Answer if its helpful to you


Posted by: Vforvijay on: 10/14/2011 [Member] Starter | Points: 25

HI.....Refer the below link.........

Jayakumars, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response