This topic is now archived and is closed to further replies.

Loading an image from a database

This topic is 5247 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

This is my code to retreive a image from a database, for some reason the image.fromfile... keeps the file open after i load it, so i can''t delete it. If i can''t delete it (And because its still open) i can''t load hte next image from the database.
            If rcs.Fields("sig").Value Is System.DBNull.Value Then
                PictureBox1.Image = Nothing
                Exit Sub
            End If


            strStream.SaveToFile("C:\sTemp.bmp", ADODB.SaveOptionsEnum.adSaveCreateOverWrite)

            PictureBox1.Image = Image.FromFile("C:\sTemp.bmp")

Its in, Please help!, Thanks.

Share this post

Link to post
Share on other sites
Heh, uh, why are you creating the temporary file in the first place? Why not just set the image from the stream directly?

How appropriate. You fight like a cow.

Share this post

Link to post
Share on other sites