Image takes control

Discussion in 'ASP .Net' started by Ola Myrgart, Nov 5, 2003.

  1. Ola Myrgart

    Ola Myrgart Guest

    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"

    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
     
    Ola Myrgart, Nov 5, 2003
    #1
    1. Advertising

  2. 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' ...>

    --
    I hope this helps,
    Steve C. Orr, MCSD, MVP
    http://Steve.Orr.net
    Hire top-notch developers at http://www.able-consulting.com




    "Ola Myrgart" <> wrote in message
    news:...
    >
    > 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"
    >
    > *** Sent via Developersdex http://www.developersdex.com ***
    > Don't just participate in USENET...get rewarded for it!
     
    Steve C. Orr [MVP, MCSD], Nov 5, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. 00_CuMPe3WaR3D12

    User Control - takes HTML as parapeter

    00_CuMPe3WaR3D12, Feb 4, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    413
    00_CuMPe3WaR3D12
    Feb 4, 2005
  2. =?Utf-8?B?QUNhdW50ZXI=?=

    Control where 'Enter Button' takes you

    =?Utf-8?B?QUNhdW50ZXI=?=, Feb 9, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    357
    William F. Robertson, Jr.
    Feb 9, 2005
  3. ashish_gokhale
    Replies:
    0
    Views:
    435
    ashish_gokhale
    May 5, 2005
  4. Charlie@CBFC
    Replies:
    2
    Views:
    488
    Charlie@CBFC
    Sep 12, 2006
  5. David C

    Validator control takes up space

    David C, Aug 24, 2007, in forum: ASP .Net
    Replies:
    1
    Views:
    1,099
    David Wier
    Aug 24, 2007
Loading...

Share This Page