Save Access Report as PDF/Binary

前端 未结 2 1246
忘了有多久
忘了有多久 2021-01-20 18:56

I am using Access 2007 (VBA - adp) front end with a SQL Server 2005 Backend. I have a report that I want to save a copy as a PDF as a binary file in the SQL Server.

2条回答
  •  囚心锁ツ
    2021-01-20 19:12

    There are different opinions if it's a good idea to store binary files in database tables or not. Some say it's ok, some prefer to save the files in the file system and only store the location of the file in the DB.

    I'm one of those who say it's ok - we have a >440 GB SQL Server 2005 database in which we store PDF files and images. It runs perfectly well and we don't have any problems with it (for example with speed...that's usually one main argument of the "file system" people).

    If you don't know how to save the files in the database, google "GetChunk" and "AppendChunk" and you will find examples like this one.

    Concerning database design:
    It's best if you make two tables: one only with an ID and the blob field (where the PDF files are stored in) and one with the ID and additional fields for filtering.
    If you do it this way, all the searching and filtering will happen on the small table, and only when you know the ID of the file you want to load, you hit the big table exactly one time and load the file.
    We do it like this and like I said before - the database contains nearly 450 GB of files, and we have no speed problems at all.

提交回复
热议问题