SQL Server 2012商店pdf [英] Sql Server 2012 store pdf

查看:137
本文介绍了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(B初始L arge OB ject)字段
  • 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.
  • 快速读取访问很重要.
  • 您正在开发使用中间层的应用程序 应用逻辑
  • Objects that are being stored are, on average, larger than 1 MB.
  • Fast read access is important.
  • You are developing applications that use a middle tier for application logic

由于很少有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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆