|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Displaying SQL Image data type informationIs 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.. Show quote "Linda U" <upd***@co.rock.wi.us> wrote in message news:1137415044.771492.106180@g47g2000cwa.googlegroups.com... > 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 > 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 Linda,
Your image is a byte array you can convert it to a picture and than show it in a picture box. See this sample for handling this. (There is a little bit extra) http://www.vb-tips.com/default.aspx?ID=f6d5cc8c-a917-482b-ab1d-253a1ec85fc3 I hope this helps, Cor 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 |
|||||||||||||||||||||||