Hello all,
I am receiving an error when I try to view an image that I have stored in my SQL database. I have used the following code :
When the page finally opens it tells me :
The XML page cannot be displayed
Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.
--------------------------------------------------------------------------------
An invalid character was found in text content. Error processing resource
I am not sure how to get this resolved. The section of my code that is commented out does not work at all, which is why I switched to the other way.
Thanks in advance,
Brian
I am receiving an error when I try to view an image that I have stored in my SQL database. I have used the following code :
Code:
cmd.Connection = conn
cmd.CommandText = "Select filetype, img from ScanInfo"
Try
conn.Open()
read = cmd.ExecuteReader(System.Data.CommandBehavior.CloseConnection)
Do While read.Read()
Response.ContentType = read.Item("filetype")
Response.BinaryWrite(read.Item("img"))
Loop
'stream.Write(pic, 0, pic.Length)
'spic = New System.Drawing.Bitmap(stream)
'Response.ContentType = "image/jpg"
'spic.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg)
Catch ex As Exception
txtTester.Text = ex.ToString
Finally
conn.Close()
stream.Close()
End Try
When the page finally opens it tells me :
The XML page cannot be displayed
Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.
--------------------------------------------------------------------------------
An invalid character was found in text content. Error processing resource
I am not sure how to get this resolved. The section of my code that is commented out does not work at all, which is why I switched to the other way.
Thanks in advance,
Brian