在sql server 2005中保存文件 [英] save a file in sql server 2005

查看:99
本文介绍了在sql server 2005中保存文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


如何在Windows应用程序中将Word文件存储到Sql Server 2005数据库中.假设当我单击一个按钮时,我需要存储文件.

在此先感谢您

Hi
How to store Word files into Sql Server 2005 database in Windows application. Say I need to store the file when one clicks in a button.

Thanks in advance

推荐答案

将其存储为blob,然后检索它,然后将返回的字节数组写到硬盘驱动器上,然后可以将其打开
You store it as a blob, and you retrieve it and then write the byte array you got back to the hard drive, then you can open it.


创建一个字段,其类型为Image.

Create a table with a field of type Image.

CREATE TABLE files
(
id int IDENTITY NOT NULL,
filebytes image
)


现在按照此处提到的步骤操作
将图像存储在数据库中 [


Now follow the steps mentioned here
Store image in Database[^]

You dont need to hesitate about Image. You can store any file in Image DataType. Just put Byte Array of the file content.

For security, store the filename and Mime Type of the file with the same record.

Cheers. :rose:


这篇关于在sql server 2005中保存文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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