hex picture data from sql to aspx page
dear friendss,advance thanks .
let me describe my problem in detail.
following
is the picture data in Hex format.
0001FFD8FFE000104A46494600010100000100010000FFDB0043000C08080A08080C0A0A0A0C0C0C0E101C121010101022181A141C28222A28262226262C303E342C2E3A2E2626364A363A40424646462A344C524C44503E444642FFDB0043010C0C0C100E1020121220422C262C4242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242FFC4001F000001050101010101010000000000000000010203
In
sql i inserted this data in an image coloumn like as follows(added
ox).
INSERT INTO [Test_mm].[dbo].[PictureTable]
([Title]
,[DateAdded]
,[MIMEType]
,[Image])
VALUES
('jjj'
,'6/22/2010 3:12:04 PM'
,'hjhg'
,'0x0001FFD8FFE000104A46494600010100000100010000FFDB0043000C08080A08080C0A0A0A0C0C0C0E101C121010101022181A141C28222A28262226262C303E342C2E3A2E2626364A363A40424646462A344C524C44503E444642FFDB0043010C0C0C100E1020121220422C262C4242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242FFC4001F000001050101010101010000000000000000010203')
after
inserting the data i tried to display this using the code below.But it
is giving me an error?
Dim ImageID As Integer =
Convert.ToInt32(Request.QueryString("ImageID"))
Using
myConnection As New
SqlConnection(ConfigurationManager.ConnectionStrings("NorthwindConnection").ConnectionString)
Const SQL As String = "SELECT [MIMEType], [Image] FROM
[PictureTable] WHERE [ImageID] = @ImageID"
Dim
myCommand As New SqlCommand(SQL, myConnection)
myCommand.Parameters.AddWithValue("@ImageID", ImageID)
myConnection.Open()
Dim myReader As SqlDataReader =
myCommand.ExecuteReader
If myReader.Read Then
Response.ContentType = myReader("MIMEType").ToString()
Response.BinaryWrite(myReader("Image"))
End
If
myReader.Close()
myConnection.Close()
End Using
can anybody help me to display this picture data?