From: DavidC on
I have an asp.net page that has an image control (named ImgSignature) inside
a Panel. When the panel is visible, I want to get the image from the database
varbinary(MAX) column and insert it into the asp Image control. I have the
following code but is not working. Can someone help? Thanks.

Using conData As SqlConnection = New
SqlConnection(DBClass.GetCoreConnectionString)
intPeopleLinkID =
Convert.ToInt32(Request.QueryString("plid"))
Const SQL As String = "SELECT [MIMEType],
[SignatureImage] FROM [ClientSignatures] WHERE [ClientID] = @ClientLinkID"
Dim myCommand As New SqlCommand(SQL, conData)
myCommand.Parameters.AddWithValue("@ClientLinkID",
intPeopleLinkID)

conData.Open()
Dim myReader As SqlDataReader = myCommand.ExecuteReader

If myReader.Read Then
Response.ContentType = myReader("MIMEType").ToString()
ImgSignature.ImageUrl = myReader("SignatureImage")
End If

myReader.Close()
conData.Close()

End Using


--
David
From: Plamen Ratchev on
Depending on the client side language capabilities you can persist the
binary data to a file and then display the image from the file, or
directly read the binary data into memory buffer and use that to
display. Here is example with persisting to file:
http://www.akadia.com/services/dotnet_read_write_blob.html

--
Plamen Ratchev
http://www.SQLStudio.com
From: DavidC on

"Plamen Ratchev" wrote:

> Depending on the client side language capabilities you can persist the
> binary data to a file and then display the image from the file, or
> directly read the binary data into memory buffer and use that to
> display. Here is example with persisting to file:
> http://www.akadia.com/services/dotnet_read_write_blob.html
>
> --
> Plamen Ratchev
> http://www.SQLStudio.com
> .
>

I would prefer not to have to write the image to a file. Can't I just insert
(stream?) the image like you insert text into a textbox? Thanks.
--
David


From: Plamen Ratchev on
You can stream binary data but as far as I know you have to change the
content of the page to image, so it should be to a new page for the
image alone. But best to post this question to ASP.NET related forums
where you can get more help on the topic.

--
Plamen Ratchev
http://www.SQLStudio.com