Sql Server 2012 存储pdf

Sql Server 2012 store pdf(Sql Server 2012 存储pdf)
本文介绍了Sql Server 2012 存储pdf的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在数据库中存储 PDF 文件以及如何使用 asp.net 显示预览.PDF文件由控件上传,然后我需要显示预览,然后我存储到数据库中.

How to store PDFs file in database and how to show preview using the asp.net. the PDFs file is uploaded by control and then i need to show preview afterward i store into the database.

    <input type="file" />

推荐答案

通常,您可以选择以下技术之一:

Generally, you can choose one of the following techniques:

  • 将文件上传到服务器的特定文件夹中,并仅将文件的 URL 存储在数据库中.之后,使用 URL 显示或下载文件
  • BLOB (Binary Large OBject) 字段中上传文件并存储在数据库中
  • Upload the file in specific folder in your server and store in your database only the URL to the file. Latter, use the URL for showing or downloading the file
  • Upload the file and store in the database in BLOB (Binary Large OBject) field

每一个都有优点和缺点,这取决于你的情况,你可以决定使用哪种技术.

Each of these, has advantages and disadvantages and it is up to your situation and you to decided which technique for use.

幸运的是,当我们使用 SQL Server 存储文件时,我们还有一个选项可以带来更好的性能 - 文件流存储.

Fortunately, when we are using SQL Server for storing files we have one more option which can lead to better performance - Filestream Storage.

建议在以下情况下使用这种类型的存储:

This type of storage is recommended in the following situations:

  • 存储的对象平均大于 1 MB.
  • 快速读取访问很重要.
  • 您正在开发使用中间层的应用程序应用逻辑

因为很少有 PDF 文件小于 1 MB,我相信您应该使用这种技术,但是:

Since, rarely PDF files are smaller then 1 MB, I believe you should use this technique but:

对于较小的对象,在数据库中存储 varbinary(max) BLOB通常提供更好的流媒体性能.

For smaller objects, storing varbinary(max) BLOBs in the database often provides better streaming performance.

您可以查看以下本 教程以激活存储.

You can check the following this tutorial in order to activate the storage.

这篇关于Sql Server 2012 存储pdf的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Execute complex raw SQL query in EF6(在EF6中执行复杂的原始SQL查询)
SSIS: Model design issue causing duplications - can two fact tables be connected?(SSIS:模型设计问题导致重复-两个事实表可以连接吗?)
SQL Server Graph Database - shortest path using multiple edge types(SQL Server图形数据库-使用多种边类型的最短路径)
Invalid column name when using EF Core filtered includes(使用EF核心过滤包括时无效的列名)
How should make faster SQL Server filtering procedure with many parameters(如何让多参数的SQL Server过滤程序更快)
How can I generate an entity–relationship (ER) diagram of a database using Microsoft SQL Server Management Studio?(如何使用Microsoft SQL Server Management Studio生成数据库的实体关系(ER)图?)