Search code examples
delphipdfsql-server-2008-r2delphi-6blobstorage

How to save a PDF file in a SQL Server column using Delphi code


G'd day, everyone...

Here is the scenario. My user wants to save a PDF file into the database (yeah, I know, that's not the optimal way to do it, but ... he pays, so I keep my mouth shut ;) ), so I decided to create a Binary column in a table in SQL Server 2008 R2 database.

And now, the problem. I'm developing in Delphi 6, and I have the slightest idea how to accomplish this..., can you provide me kinda help here, please?

Thanks in advance for your kindness.


Solution

  • You can stream the PDF into a blob field. I use this technique for saving .JPG and .PNG images into a DBISAM database. You can probably find examples of doing this for images (stream an image into a blob field).