存储和检索SQL Server 2005中.ZIP文件 [英] Store and Retrieve .ZIP file in SQL SERVER 2005

查看:158
本文介绍了存储和检索SQL Server 2005中.ZIP文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何存储文件的.zip在SQL Server 2005数据库编程?

How to store .zip file in SQL SERVER 2005 database programatically?

和如何找回回来?

如果你认为存储.zip文件到一个数据库不是一个优雅的方式,请告诉我。

If you think that storing a .zip file into a database is not an elegant way, please tell me

做一个更好的方法/标准做法相同的想法

the idea of making a better approach / standard practice for the same

我使用C#,Asp.net和SQL Server 2005

I am using C#, Asp.net and Sql Server 2005

请寄给我的code。

推荐答案

有一对夫妇,你可以使用的方法。最简单的就是留在文件系统中的文件,并存储在SQL Server内部的文件路径。您的应用程序会在运行时检索文件的路径,并使用该路径来加载文件。在文件系统中存储​​也有它的缺点,虽然 - 文件不与数据库进行备份,更改文件位置,或删除文件将不更新SQL Server,等

There are a couple of methods that you can employ. The simplest is to leave the files on the filesystem, and to store the file path inside SQL Server. Your app would retrieve the file path at runtime, and use said path to load the file. Storing in the filesystem also has it's disadvantages though - files aren't backed up with the database, changes to the file location, or file deletion won't update SQL Server, and so on.

在SQL Server中存储肯定是一种选择为好。你的SQL Server 2005,所以您将无法使用FILESTREAM功能(在SQL Server 2008中引入),但你可以将其存储在本地的SQL Server BLOB类型。

Storing within SQL Server is certainly an option as well. You're on SQL Server 2005, so you won't be able to use the FILESTREAM feature (introduced in SQL Server 2008), but you will be able to store it in a native SQL Server blob type.

下面的一个很好的介绍以blob类型在SQL Server由丹尼樱桃。
这里是 写作斑点的例子。

Here's a good introduction to blob types in SQL Server by Denny Cherry. Here's an example of writing blobs using C#.

这篇关于存储和检索SQL Server 2005中.ZIP文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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