我应该如何/应该为存储的图像准备一个文件夹,从sql引用,使用C#保存图像位置

发布于 2024-09-10 03:44:51 字数 226 浏览 1 评论 0原文

真的希望有人可以提供一些代码示例或为我指明正确的方向(使用 C#.net 示例)。我确实尝试检查之前是否有人问过这个问题..但并没有真正找到可以回答我所有问题的代码示例。

  1. 保存文件的图像文件夹 - 应该在解决方案中还是其他地方
  2. 什么样的数据类型 - 例如 vchar(150) 可以吗?
  3. 将图像保存在文件夹位置并将图像位置写入数据库的典型/最理想的代码是什么。

Really hoping someone can provide some code sample or point me in the right direction (with examples C#.net). I did try to check if this question was asked before.. but didn't really find code samples which answered all my questions.

  1. Image folder for saved files -should this be in the solution or somewhere else
  2. What kind of data type - will vchar(150) for example for ok?
  3. What will be the typical/most ideal code to save the image in the folder location and write the image location in the db.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

情深已缘浅 2024-09-17 03:44:51

如果您使用 SQL Server 2008,我将使用文件流数据类型。它允许您执行您想要执行的操作,但与数据库完全集成(您将看到列 - 图像 - 作为 varbinary(MAX))。

If you use SQL Server 2008 I would use the filestream data type. It allows for what you want to do but totally integrated with the DB (you see the column -- image -- as a varbinary(MAX)).

烟花肆意 2024-09-17 03:44:51

不完全确定您的意思,但这可能会为您指明正确的方向:

1)将其保留在解决方案中,除非它要被多个应用程序调用
2)根据您的编码类型使用 Varchar(Max) 或 NVarchar(Max)
3)你需要:
- 在 db 中,将图像位置写入表的存储过程。
- 在C#中,一个连接对象和一个命令对象来调用一个存储的
程序

Not wholly sure what you mean but this could point you in the right direction:

1) Keep it in the solution unless it is to be called by more than application
2) Just use Varchar(Max) or NVarchar(Max) depending on your encoding type
3) You'll need:
- In db, a stored procedure to write the image location to a table.In
- In the C#, a connection object and a command object to call a stored
procedure

山川志 2024-09-17 03:44:51

NTFS - 支持每个文件的多个数据流。

NetFrameWork 不包括对这些流的支持。

您可以使用 Interop 来访问备用数据流。

CodeProject 上的示例 Csharp 代码:
http://www.codeproject.com/KB/shell/csadsdetectorarticle.aspx

注意:当您在 Xp 上从互联网下载文件时,下载的文件有两个流,MyFile 和 MyFile:Zone.Identifier

该流包含如下一些内容:
[区域传输]
区域ID=3

NTFS - Suports multiple Data Streams for each file.

NetFrameWork do´nt include support for those streams.

You can use Interop to gain access to Alternate Data Streams.

Sample Csharp code on CodeProject:
http://www.codeproject.com/KB/shell/csadsdetectorarticle.aspx

Note.: When you download a file from internet on Xp, the Dowloaded files has two Streams, MyFile and MyFile:Zone.Identifier

This stream contains some like this:
[ZoneTransfer]
ZoneId=3

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文