Hello all,
I finally got the images to come out correctly from this column in my SQL Server. Now I am trying to get a Word document to write properly to either the screen or Word itself. This is the code that I am using :
This is a short version of the information that I am getting out:
Does anyone have any ideas as to what else I need to try. I have searched the web and everything I have seen says that the code I am currently using is what should work.
Thanks in advance,
Brian
I finally got the images to come out correctly from this column in my SQL Server. Now I am trying to get a Word document to write properly to either the screen or Word itself. This is the code that I am using :
Code:
Dim conn As New System.Data.SqlClient.SqlConnection
Dim cmd As New System.Data.SqlClient.SqlCommand
Dim da As New System.Data.SqlClient.SqlDataAdapter
Dim ds As New System.Data.DataSet
Dim read As System.Data.SqlClient.SqlDataReader
Dim stream As System.IO.MemoryStream
conn.ConnectionString = "server=dc1;database=hawkeye;trusted_connection=yes"
cmd.Connection = conn
cmd.CommandText = "Select filetype, img from ScanInfo Where filetype = 'doc'"
da.SelectCommand = cmd
Try
conn.Open()
da.Fill(ds, "Img")
Dim pic() As Byte = ds.Tables("Img").Rows(0).Item("img")
'stream = New System.IO.MemoryStream(pic, True)
'stream.Write(pic, 0, pic.Length)
Response.ContentType = "application/msword"
Response.BinaryWrite(pic)
Catch ex As Exception
txtTest.Text = ex.ToString
Finally
conn.Close()
'stream.Close()
End Try
This is a short version of the information that I am getting out:
Code:
ÐÏ à¡± á > þÿ ¡ « þÿÿÿ Ÿ ® € ? ‚ ƒ „ … † ‡ ˆ ‰ Š ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿì¥Á ` ø ¿ å
bjbjËsËs ©- © © e z ÿÿ ÿÿ ÿÿ ¤ ?
?
?
?
Does anyone have any ideas as to what else I need to try. I have searched the web and everything I have seen says that the code I am currently using is what should work.
Thanks in advance,
Brian