Can anyone point me in the direction of a simple (the simpler the better) example of how I can save / read images (or MS Word documents) from a SQL Server database ?
Any suggestions would be appreciated,
Thanks in advance,
Steve
Why dont you just create a column in your database which is a string data type, store the file name in that column, then you can reference the file from a central store.
For instance, say you have a images folder under your root directory.
your table could look something like this.
ID - Image Name
1 test1.jpg
2 test2.jpg
you could just pull the information out of the database and build the full path and display the images, or build them into a hyperlink, whatever you want to do. I have never been 100% keen on saving files inside the database, but i am sure people would disagree with me.
e.g. String strFile = "/images/" + yourFilePath;
sorry for the very brief example, hope this gives you a start.
Unless you have a compelling reason to store the 'files' as columns on your database (for example if you want to be able to recover them from the database logs), then I'd go with Modica82's solution.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.