Link to home
Start Free TrialLog in
Avatar of kpbarem
kpbarem

asked on

How to store a retrieve a PDF in SQL Server

I have an application that i've written in asp.net that allows a user to select a 1 page PDF file from their computer and upload it to a SQL Server database.  A second application I've written retrieves the PDF file and displays it to a user.  

There is a lot more to this application but these are the basic concepts of this problem.  Ideally when the user of the first application hits the upload button I will call a stored procedure that passes in the PDF from their computer and stores it to the database.  

Then when the user of the second application clicks a link I can retrieve the PDF file from the database and display it to the user.  I've read that you can use VARBINARY data type to store the PDF but i'm not sure how to do this.

Has anyone done anything like this and could provide me some sample code?  Any help you could offer would be appreciated.

Thanks experts!
SOLUTION
Avatar of John (Yiannis) Toutountzoglou
John (Yiannis) Toutountzoglou
Flag of Greece image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
If you are using SQL Server 2008 it may be worth looking into FILESTREAM
http://www.simple-talk.com/sql/learn-sql-server/an-introduction-to-sql-server-filestream/
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of kpbarem
kpbarem

ASKER

Thank you!!