Hi all,
i am facing a problem to display image in IE 7.0 which are coming from my database (SQLSEREVER2005).
for displaying image i am using folloeing code.

Public Sub DataImage()
       Connstring = ConfigurationManager.ConnectionStrings("TestingConnectionString").ConnectionString
       'Conn = New SqlConnection(ConfigurationManager.AppSettings("conn_string"))
       Conn = New SqlConnection(Connstring)
       If Conn.State = ConnectionState.Closed Then Conn.Open()
       i = DropDownList1.SelectedValue

       Dim sqlcommand2 = New SqlCommand("select pictureName,PictuerID from pictureImage where PictuerId='" & i & "'", Conn)
       dr = sqlcommand2.ExecuteReader()

       If dr.Read Then
           IM = dr.Item("pictureName")// picture name
           Panel1.Width = 200
           Panel1.Height = 200

                 
           Image1.ImageUrl = Server.MapPath("~") & "\" & IM
                 Image1.Height = 100
           Image1.Width = 100
       End If

   End Sub

this code excute fine but image are not displaying
Its urgent,thks

What is the "IM" that you have assigned the record to -- IM = dr.Item("pictureName")// picture name

IM is public defined string in which i m saving my picture name which r coming from database.Images r saved in a folder which exist in project and i will receive my picture from that folder.picture r saved in this folder

Well--if the images are stored in a folder - you have to specify the folder. Currently you have specified that the image should be retrieved from the root folder:
Image1.ImageUrl = Server.MapPath("~") & "\" & IM

If your images are stored for e.g in the Images folder in the project -your code should be:
Image1.ImageUrl = Server.MapPath("~") & "\Images" & IM

thks for your reponse
I am saving my folder name in my database with my filename e.g image\picturename.jpg
and retriving it by Server.MapPath("~") & "\" & image\picturename.jpg

code is excuting fine,only image r not showing in my img control eithr asp or html
image r showing in IE 6.0 but not in IE 7.0

Regards
lokesh singhal

Well--if the images are stored in a folder - you have to specify the folder. Currently you have specified that the image should be retrieved from the root folder:
Image1.ImageUrl = Server.MapPath("~") & "\" & IM

If your images are stored for e.g in the Images folder in the project -your code should be:
Image1.ImageUrl = Server.MapPath("~") & "\Images" & IM

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.