Tuesday, August 17, 2010

Display image on web page asp.net 2.0?

I'm having trouble displaying a binary image to a web page, the following code executes fine but I don't know how to display the image after Response.BinaryWrite(myReader("FileData"...





Private Sub getUserListings(ByVal UserName As String)





'display user listings


Dim myConnection As New SqlConnection(System.Configuration.Confi...





Try


Const SQL As String = "SELECT ContentType, FileData FROM dbo.tblImages"


Dim myCommand As New SqlCommand(SQL, myConnection)





myConnection.Open()


Dim myReader As SqlDataReader = myCommand.ExecuteReader





If myReader.Read Then


Response.ContentType = myReader("ContentType").ToString()


Response.BinaryWrite(myReader("FileData"...





End If





myReader.Close()


myConnection.Close()


Catch ex As Exception


MsgBox(ex.Message)


E

Display image on web page asp.net 2.0?
this was a MCPD mock test question I wish I knew the specific answer.


Basically there is a setting on one of the ADO.net related objects that deal with binary issues


No comments:

Post a Comment