保存/载入图片与.net和放大器的最佳方式; SQL Server 2005的? [英] Best way to save/load pictures with .Net & SQL Server 2005?

查看:115
本文介绍了保存/载入图片与.net和放大器的最佳方式; SQL Server 2005的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是典型的方法来处理产品图片的网页畅销的产品?说我有本本或电脑组件等,都具有自己的样品图片,例如数据库......我应该把它们保存到数据库作为二进制数据,或以某种方式处理这些事件的codebehind,将其保存到与该图片文件的相应链接的目录被保存到产品表中的DB?

What is the typical way to handle product pictures in a web-page selling products? Say I had a database with books or computer components etc, all of which have their own sample pictures for example... Should I save them into the DB as binary data, or somehow handle them in the codebehind, saving them into a directory with the appropriate link to the picture file being saved into the product table in the DB?

我试图做一个销售公司的例子,而我能想出办法来做到这一点,我不知道什么是在编程业务使用的典型标准?

I'm trying to make a sales company example, and while I can come up with ways to do this, I wonder what is the typical norm used in the programming business?

更新:的存储在另一个系统或备用数据库的是不是一种选择,而在以供将来参考可能的替代品的信息AP preciated。我所要提供的Visual Studio 2008和SQL Server的2008分之2005,一台计算机上,有一个ASP.Net项目。因此文件将不得不被保存到网页项目内的目录,或进入所述一个DB中正在使用它

Update: Storing on another system or alternate DB's is not an option, while the information on possible alternatives for future reference is appreciated. All I have available to are Visual Studio 2008 and SQL Server 2005 / 2008, on one computer, with one ASP.Net project. So the files would have to be saved into a directory within the web-page project, or into the one DB being used by it.

推荐答案

保存在文件系统,但是里面的DB 文件
保存文件到数据库使其成为所有应用程序数据的单一备份点,使一个小的安全面为您的应用程序,因为你不需要写权限的文件夹来存储文件。

Saving files on filesystem but inside a DB
Saving files into DB makes it a single backup point for all your application data and makes a smaller security surface for your app because you don't need a write permission folder for storing files.

使用SQL Server 2008中微软引入了名为 FILESTREAM一个新的数据存储机制,在文件夹中的常规文件存储数据。但是,你可以访问他们(和存储他们的元数据)通过表格。您可以将文件存储为varbinary(max)和他们得到存储在文件系统中的配置。这些文件也将得到回升,由DB备份程序。这样,你得到的两全其美在一个单一的解决方案。

With SQL Server 2008 Microsoft introduced a new data storage mechanism called FILESTREAM that stores data in folders as regular files. But you can access them (and store their metadata) via tables. You can store files as varbinary(max) and they get stored on the filesystem as configured. These files will also get picked up by DB Backup procedure. This way you get the best of both worlds in a single solution.

了解更多关于它这里

后festum笔记
  我要指出的是,这个问题的作者没有提到他们可能会使用SQL Server 2008,以及当有任何好处。这是这个答案是与2008年版本的唯一原因,因为这真的是他们的问题的最佳解决方案。

Post-festum note
I have to point out that authors of the question did mention they may use SQL Server 2008 as well when there are any benefits. That's the only reason this answer is related to version 2008, because this really is the optimal solution for their problem.

这篇关于保存/载入图片与.net和放大器的最佳方式; SQL Server 2005的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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