Displaying SQL Image data type information

  • Thread starter Thread starter Linda U
  • Start date Start date
L

Linda U

Is there a way to Memory Stream Information into a WebBrowser Control?
I have an SQL Image (could be any file type) that I would like to
display in a WebBrowser Control, currently I have to File Stream this
to a temporary location and then display it in the WebBrowser. I would
like to skip this extra step if possible. There is no need for the
user to update the information in the WebBrowser it is simply for
display only. Maybe there is a better control that I should be using?
Is there a different control that can be used to display SQL Image
data?

Thanks for your help,
Linda
 
You can use a HTTPHandler and create your own images from that if I
understand you correctly. What does the code you're using right now look
like though, just so I can see how you're displaying the values..
 
I'll look into HTTPHandler. Here is the code I am currently using...

cmd = New SqlCommand
cmd.Connection = cn
cmd.CommandText = "SELECT SD_Image as Image, SD_Title as Title
FROM SupportDocs WHERE SD_CallID = " & CInt(lblID.Text) & " and
SD_ImageNum = " & ImageNum

dr = cmd.ExecuteReader()
If dr.HasRows Then
dr.Read()
Dim b(dr.GetBytes(0, 0, Nothing, 0, Integer.MaxValue) - 1)
As Byte
dr.GetBytes(0, 0, b, 0, b.Length)
strTitle = dr.Item("Title")
dr.Close()
CloseHelpDeskDatabase()

Dim fs As New System.IO.FileStream(DestFilePath & strTitle,
IO.FileMode.OpenOrCreate, IO.FileAccess.ReadWrite,
IO.FileShare.ReadWrite)
fs.Write(b, 0, b.Length)
fs.Close()

oDocument = Nothing
AxWebBrowser1.Navigate(DestFilePath & Trim(strTitle))
End If
 
It looks like HTTPHandler is only for ASP.Net programs. This is a
windows VB.Net program. Any other suggestions? The different file
types I'm trying to display are doc, xls, jpeg, pdf... it really could
be just about anything.

Thanks,
Linda
 
This works fine if what was saved in the file is a picture but I get an
error (Invalid Parameter) if the file contains a word or excel
document. Is there a way to display these file types other than a
WebBrowser control?\

Linda
 
Linda,
This works fine if what was saved in the file is a picture but I get an
error (Invalid Parameter) if the file contains a word or excel
document. Is there a way to display these file types other than a
WebBrowser control?\
Not that I know,

Cor
 
Back
Top