Display Image from Database in Image Control

Discussion in 'ASP .Net' started by chrispragash@hotmail.com, Aug 25, 2005.

  1. Guest

    Hello Everybody,

    I have a server control that stores an image in the database as an
    image datatype. I would like to display this image (may be in an image
    control) along with other text in a page. What is the best way to
    achieve this functionality. Thanks for all the help in advance.
    Regards, Chris
    , Aug 25, 2005
    #1
    1. Advertising

  2. Metalore

    Joined:
    Oct 18, 2006
    Messages:
    2
    Hi All,

    I also have the same problem, can anyone give some advice please??

    I have an image datafield in my database and am able to take this picture and display it on a page. Using Response.WriteBinary to do this.

    However, I also have text which should be going to the page but all I get is the image. When i comment out the response.writebinary line I get the text!!

    Below is my code...


    Dim adapt As New SqlDataAdapter(cmd)
    Dim table As New Data.DataTable

    adapt.Fill(table)

    Dim row As Data.DataRow
    For Each row In table.Rows

    Dim ID As String = (row("ID"))
    lblID.Text = ID
    Dim Name As String = (row("Name"))
    lblName.Text = empName

    'this above code works and does output the text to the screen as I would expect, the problem is below when I try output the image.....

    Response.BinaryWrite(row("Photo"))

    Next

    'When I include the above line, the image is the only thing being written to the screen, dont know what happened to the ID and Name, anyone any ideas?

    I would appreciate any thoughts or advice on this.

    Kind Regards,

    Tony
    Metalore, Oct 18, 2006
    #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. Sandi
    Replies:
    3
    Views:
    1,743
    Natty Gur
    Nov 6, 2003
  2. Olav Tollefsen

    How to display image blob from database?

    Olav Tollefsen, Apr 25, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    1,369
    =?Utf-8?B?QmlsbCBCb3Jn?=
    Apr 25, 2004
  3. =?Utf-8?B?U1M=?=
    Replies:
    3
    Views:
    3,808
    Juan T. Llibre
    May 15, 2005
  4. Imran Aziz
    Replies:
    4
    Views:
    1,498
    Imran Aziz
    Aug 11, 2005
  5. Replies:
    1
    Views:
    213
Loading...

Share This Page