Question Photos in a database

kfirba

Well-known member
Joined
Dec 29, 2012
Messages
77
Programming Experience
1-3
Hello!

I want to have a database which contains photos of movies in it.
My idea to do it was storing in the database the path of the photo in the database, and then use retrieve the path from the database and use it in a picturebox control. Is it what I need to do? or maybe there is another method to do so?

Thanks in advance!
 
You certainly can store the path of an image in a database but the problem with that is that the image file could be removed independent of your app. The issue with storing the image itself in the database is that the data file can grow rapidly if the number of images grows large. If you want to go with the second option then take a look at this:

Saving Images in Databases

One way to prevent the data file growing too large while still using that same method is to use SQL Server Express as your database and turn on the FILESTREAM option for the instance. That way SQL Server will store large binary data values outside the data file itself but the API is still the same so it is transparent to you.
 
Putting large amounts of binary data in a database is dirty and perverted, don't do it ;)
 
Putting large amounts of binary data in a database is dirty and perverted, don't do it ;)

It's exactly for that reason that the FILESTREAM feature was added to SQL Server (including Express). The application can behave as though the data is stored in the database but the database actually stores it outside the main data file. It provides the best of both worlds.
 
Back
Top