Display Image from Database in Image Control

C

chrispragash

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
 
Joined
Oct 18, 2006
Messages
2
Reaction score
0
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,731
Messages
2,569,432
Members
44,832
Latest member
GlennSmall

Latest Threads

Top