将.doc或.pdf保存在sql或oralce数据库中 [英] Saving .doc or .pdf in sql or oralce database

查看:92
本文介绍了将.doc或.pdf保存在sql或oralce数据库中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是ASP.net的新手,正在尝试开发一个文档管理系统,该系统将pdf/doc文档保存在数据库中并从数据库中调出.

我知道如何在服务器上上载和保存文件,但是可以将它们保存到数据库(sql或oracle)中吗?还是我只打算将文件保存在服务器上,并在数据库中存储链接?

我觉得第二个选项的安全性较低,就好像文件在服务器上移动了一样,数据库上的指针也将损坏.

I am new to ASP.net and am trying to develop a document management system where pdf/doc documents are saved in and recalled form a database.

I know how to upload and save files on the server, but can they be saved into the database (sql or oracle)? Or should I plan to just save the files on the server, and store a link on the database?

I feel less secure with the second option as if the file is moved on the server the pointer on the database will be broken.

推荐答案

保存文件不是什么大问题.
将整个文件转换为字节数组.您可以使用FileStream来获取File字节.

创建一个具有图像"日期类型的表,并将字节数组直接存储在该字段中.另外,不要忘记将文件名和内容类型存储在同一张表中.

您可以看到此内容:

http://www.shabdar.org/store-save-images-in-sql- server.html [^ ]

:rose:
Saving file is not a big deal.
Convert the whole file into byte array. You might use FileStream to get the File bytes.

Create a table with Image date type and store the byte array directly in that field. Also dont forget to store the name of the file and the content type in the same table.

You can see this :

http://www.shabdar.org/store-save-images-in-sql-server.html[^]

:rose:


这篇关于将.doc或.pdf保存在sql或oralce数据库中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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