are you retrieving image or image path from database. ? kassa www.elinklanka.com
On Feb 24, 12:42 pm, "m...@ni" <[email protected]> wrote: > hi Afsal,hru? > > wel its better to save the picture name (along with full directory > path) in the database,when you are insertng the information related to > picture into the database, > now what you are doing is, you first save the picture name in the > database, and you retreive it very well,but when you give a path,it > doesnt locate the picture, > . > Here is a sample code,while inserting picture record into the > database,i hope it'l solve ur problem. > > ----------------------------------------------------------------------------------------------------------------------------------------- > FilePicture.PostedFile.SaveAs(Server.MapPath("CandidateImages\\" + > FilePicture.FileName)); > > this comand will save your picture in that particular folder. > > >>>---suppose that "FilePicture" is the id which i gave to the "picture > >>>upload control" > >>>---"CandidateImages" is the folder name, in which m gona save the file > >>>into. > > ----------------------------------------------------------------------------------------------------------------------------------------- > > -------------------------------------------------------------------------------------------------------------------- > string PicPath = "CandidateImages\\" + FilePicture.FileName; > > now this variable holds the actual path,where that picture is > placed,you its better to save this variable in the database table i.e > SqlCommand ObjCom= new SqlCommand("Insert into Table(PicturePath) > Values(@PicturePath)"); > ObjCom.Parameters.AddParameters("@PicturePath",PicPath); > -------------------------------------------------------------------------------------------------------------------- > > ----------------------------------------------------------------------------------------------------------------------------------- > now when u r about to retreive the path in ImageBtn,you just need to > write like wise: > ImageButton1.ImageUrl = ds.Tables[0].Rows[0][6].ToString();
