• <i id='QOeFK'><tr id='QOeFK'><dt id='QOeFK'><q id='QOeFK'><span id='QOeFK'><b id='QOeFK'><form id='QOeFK'><ins id='QOeFK'></ins><ul id='QOeFK'></ul><sub id='QOeFK'></sub></form><legend id='QOeFK'></legend><bdo id='QOeFK'><pre id='QOeFK'><center id='QOeFK'></center></pre></bdo></b><th id='QOeFK'></th></span></q></dt></tr></i><div id='QOeFK'><tfoot id='QOeFK'></tfoot><dl id='QOeFK'><fieldset id='QOeFK'></fieldset></dl></div>

    <small id='QOeFK'></small><noframes id='QOeFK'>

    1. <legend id='QOeFK'><style id='QOeFK'><dir id='QOeFK'><q id='QOeFK'></q></dir></style></legend><tfoot id='QOeFK'></tfoot>
        • <bdo id='QOeFK'></bdo><ul id='QOeFK'></ul>
      1. WinForms 应用程序设计——将文档从 SQL Server 移动

        时间:2023-06-07
          <tbody id='FSyop'></tbody>
        <i id='FSyop'><tr id='FSyop'><dt id='FSyop'><q id='FSyop'><span id='FSyop'><b id='FSyop'><form id='FSyop'><ins id='FSyop'></ins><ul id='FSyop'></ul><sub id='FSyop'></sub></form><legend id='FSyop'></legend><bdo id='FSyop'><pre id='FSyop'><center id='FSyop'></center></pre></bdo></b><th id='FSyop'></th></span></q></dt></tr></i><div id='FSyop'><tfoot id='FSyop'></tfoot><dl id='FSyop'><fieldset id='FSyop'></fieldset></dl></div>

        <small id='FSyop'></small><noframes id='FSyop'>

        <legend id='FSyop'><style id='FSyop'><dir id='FSyop'><q id='FSyop'></q></dir></style></legend>

            • <bdo id='FSyop'></bdo><ul id='FSyop'></ul>

                  <tfoot id='FSyop'></tfoot>

                  本文介绍了WinForms 应用程序设计——将文档从 SQL Server 移动到文件存储的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  我有一个连接到 SQL Server 的标准 WinForms 应用程序.该应用程序允许用户使用图像列将当前存储在数据库中的文档上传到表格中.

                  I have a standard WinForms application that connects to a SQL Server. The application allows users to upload documents which are currently stored in the database, in a table using an image column.

                  我需要更改此方法,以便将文档存储为文件,并将指向该文件的链接存储在数据库表中.

                  I need to change this approach so the documents are stored as files and a link to the file is stored in the database table.

                  使用当前的方法 - 当用户上传文档时,他们不受存储方式的影响,因为他们连接到数据库,他们不需要知道关于文件存储位置的任何信息,没有特殊的目录权限等是必要的.如果我为文档设置网络共享,我希望避免任何 IT 问题,例如用户必须有权访问此目录才能上传或访问现有文档.

                  Using the current approach - when the user uploads a document they are shielded from how this is stored, as they have a connection to the database they do not need to know anything about where the files are stored, no special directory permissions etc are required. If I set up a network share for the documents I want to avoid any IT issues such as the users having to have access to this directory to upload to or access existing documents.

                  有哪些选项可以做到这一点?我想有一个临时数据库,以与当前方法相同的方式将文档上传到其中,然后在服务器上运行一个进程以将这些文件保存到文件存储中.然后可以删除并重新创建该数据库以回收任何空间.有没有更好的方法?

                  What are the options available to do this? I thought of having a temporary database where the documents are uploaded to in the same way as the current approach and then a process running on the server to save these to the file store. This database could then be deleted and recreated to reclaim any space. Are there any better approaches?

                  附加信息:我的应用程序没有网络服务器元素,所以我认为 WCF 服务是不可能的

                  ADDITIONAL INFO: There is no web server element to my application so I do not think a WCF service is possible

                  推荐答案

                  您是否有理由首先将文件从数据库中取出?

                  Is there a reason why you want to get the files out of the database in the first place?

                  如何仍然将它们保存在 SQL Server 中,但使用 FILESTREAM 列 而不是 IMAGE?

                  How about still saving them in SQL Server, but using a FILESTREAM column instead of IMAGE?

                  引自链接:

                  FILESTREAM 使基于 SQL Server 的应用程序能够存储非结构化的文件系统上的数据,例如文档和图像.应用可以利用丰富的流 API 和文件的性能同时保持系统之间的事务一致性非结构化数据和相应的结构化数据.

                  FILESTREAM enables SQL Server-based applications to store unstructured data, such as documents and images, on the file system. Applications can leverage the rich streaming APIs and performance of the file system and at the same time maintain transactional consistency between the unstructured data and corresponding structured data.

                  FILESTREAM 将 SQL Server 数据库引擎与 NTFS 文件集成系统通过将 varbinary(max) 二进制大对象 (BLOB) 数据存储为文件系统上的文件.Transact-SQL 语句可以插入、更新、查询、搜索和备份 FILESTREAM 数据.Win32 文件系统接口提供对数据的流式访问.

                  FILESTREAM integrates the SQL Server Database Engine with an NTFS file system by storing varbinary(max) binary large object (BLOB) data as files on the file system. Transact-SQL statements can insert, update, query, search, and back up FILESTREAM data. Win32 file system interfaces provide streaming access to the data.

                  FILESTREAM 使用 NT 系统缓存来缓存文件数据.这有助于减少 FILESTREAM 数据可能对数据库引擎产生的任何影响表现.不使用 SQL Server 缓冲池;因此,这内存可用于查询处理.

                  FILESTREAM uses the NT system cache for caching file data. This helps reduce any effect that FILESTREAM data might have on Database Engine performance. The SQL Server buffer pool is not used; therefore, this memory is available for query processing.

                  这样你就可以两全其美:
                  文件将作为文件存储在硬盘上(可能比将它们存储在数据库中更快),但您不必关心文件共享、权限等.

                  So you would get the best out of both worlds:
                  The files would be stored as files on the hard disk (probabl faster compared to storing them in the database), but you don't have to care about file shares, permissions etc.

                  请注意,您至少需要 SQL Server 2008 才能使用 FILESTREAM.

                  Note that you need at least SQL Server 2008 to use FILESTREAM.

                  这篇关于WinForms 应用程序设计——将文档从 SQL Server 移动到文件存储的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:适用于 Windows XP 的 SQL Server 2012 Management Studio 下一篇:如何将 DataGridView 中的图像显示到 PictureBox?

                  相关文章

                  最新文章

                  <legend id='gu2nu'><style id='gu2nu'><dir id='gu2nu'><q id='gu2nu'></q></dir></style></legend>

                  <i id='gu2nu'><tr id='gu2nu'><dt id='gu2nu'><q id='gu2nu'><span id='gu2nu'><b id='gu2nu'><form id='gu2nu'><ins id='gu2nu'></ins><ul id='gu2nu'></ul><sub id='gu2nu'></sub></form><legend id='gu2nu'></legend><bdo id='gu2nu'><pre id='gu2nu'><center id='gu2nu'></center></pre></bdo></b><th id='gu2nu'></th></span></q></dt></tr></i><div id='gu2nu'><tfoot id='gu2nu'></tfoot><dl id='gu2nu'><fieldset id='gu2nu'></fieldset></dl></div>
                1. <small id='gu2nu'></small><noframes id='gu2nu'>

                  1. <tfoot id='gu2nu'></tfoot>

                        <bdo id='gu2nu'></bdo><ul id='gu2nu'></ul>