Image takes control

  • Thread starter Thread starter Ola Myrgart
  • Start date Start date
O

Ola Myrgart

Hi !

I have a problem how to display an image in a different page together
with some text. The image is stored in a SQL DB and the insertfunction
works well. It´s when I try to wiew the image on another side the
problem occurs. The image takes control. Here is some code.

Dim intKundID As Integer
Dim strSelect As String
Dim conn As SqlConnection
Dim cmdSelect As SqlCommand
Dim dtrReport As SqlDataReader

intKundID = Request.QueryString("id")

conn = New
SqlConnection("server=localhost;uid=sa;pwd=idioterna;database=annonser")
strSelect = "Select * from kunder where KundID=@KundID"
cmdSelect = New SqlCommand(strSelect, conn)
cmdSelect.Parameters.Add("@KundID", intKundID)

Try
conn.Open()
dtrReport = cmdSelect.ExecuteReader()

If dtrReport.Read Then
lblRubrik.Text = dtrReport("Rubrik")
lblAnnonstext.Text = dtrReport("Annonstext")
lblEpost.Text = dtrReport("Epost")
lblTelefon.Text = dtrReport("Telefon")
lblDatum.Text = dtrReport("Datum")
Response.BinaryWrite(CType(dtrReport("Image"),Byte()))
End If


How do i solve this ??
OM "Myggan"
 
You cannot write an image directly to an HTML page. You
can only put links to images in a page.
Normally your img tag would point to a jpg or a gif image file.
In your case you'll want it to point to a special page you've designed
specifically for outputting these images.
For example:
<img src='myimage.aspx' ...>
 
Back
Top