Well, the article given to you by Sandeep does describe a way to do it. Thought, I'm unclear exactly what you're trying to do and you didn't say if you were using C# or VB. I can show you some code that I used to extract an image from the database, without writing anything to the disk...which the article given does:
Public Function GetThumbnailFromDb(ByVal DataID As Long) As Image
Dim wasOpen As Boolean = False
If connectionString.State = ConnectionState.Open Then
wasOpen = True
Else
connectionString.Open()
End If
Dim DataDS As New DataSet
Dim newDataAdapter As OleDbDataAdapter
Dim sql As String = "SELECT Thumbnail, SizeMode FROM Data WHERE ID = " & DataID & ";"
newDataAdapter = New OleDbDataAdapter(sql, connectionString)
newDataAdapter.Fill(DataDS, "Data")
newDataAdapter.Dispose()
If Not wasOpen Then
connectionString.Close()
End If
Dim result As Image = Nothing
Dim temp() As Byte
If Not IsDBNull(DataDS.Tables("Data").Rows(0).Item("Thumbnail")) Then
temp = DataDS.Tables("Data").Rows(0).Item("Thumbnail")
result = Image.FromStream(New MemoryStream(temp))
result.Tag = DataDS.Tables("Data").Rows(0).Item("SizeMode")
End If
Return result
End Function
It uses the
System.Data.OleDb
library. This will extract the image into a form that you can use however you want. If you wanted to show all of the images, you would use your
Select
statement and just cycle through all of the rows and convert the data.
[Modified]
What in the world is the 1 vote and 2 vote for? Was the information I provided inaccurate?
No!
You tell me what he was asking and provide an answer. I was trying to help in what way I could. If you don't think it answers the question, but is still accurate, give it a 3.
What's with all the negativity!?