C# - 导出SQL Server CE .sdf文件 [英] C# - Export SQL Server CE .sdf file

查看:161
本文介绍了C# - 导出SQL Server CE .sdf文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好!



是否可以使用Visual Studio 2012中的SaveFileDialog来允许用户将.sdf文件保存在他们想要的任何地方?这就是我在程序安装在最终用户的计算机上时将.sdf文件导出到项目位置(或已安装的目录)之外的含义。或者savefiledialog仅限于基于文本的文件。



我们正在制作项目的第一部分的管理方面,我开始和需要的原因导出.sdf文件,以便管理员可以上传.sdf文件,以便项目的第一部分可以检测更改并自动下载.sdf文件并更新数据库。

Hi everyone!

Is it possible to use the SaveFileDialog in Visual Studio 2012 to allow the user to save a .sdf file anywhere they want to? That's what I mean by "exporting" the .sdf file out of the project location (or installed directory) when the program is installed on an end-user's computer. Or is savefiledialog only limited to text-based files.

We are making an administrative side of the 1st part of the project that I began on and the reason for needing to export the .sdf file so the administrators can upload the .sdf file so the 1st part of the project can detect changes and download the .sdf file automatically and update the database.

推荐答案

您可以对任何类型的文件使用 SaveFileDialog



一些未经请求的建议

我会谨慎地允许最终用户将数据库文件保存在他们想要的任何地方。过了一会儿,你可能会在多个地方找到副本。一个选项是自动将副本保存到编码到您的应用程序中的位置。更好(更好!),将LastChanged DateTimestamp添加到数据库中的每个表,并使用它来确定自上次检查以来哪些行已更新。无论何时执行INSERT或UPDATE,都将LastChanged设置为NOW()。
You can use SaveFileDialog for any type of file.

Some unsolicited advice
I would be cautious about allowing your end-user to save your database file anywhere they want. After a while, you may end up with copies in multiple places. An option would be to automatically save the copy to a location coded into your application. Better yet (much better!), add a LastChanged DateTimestamp to each table in your database and use that to determine which rows have been updated since the last check. Set LastChanged to NOW() whenever you do an INSERT or UPDATE.


研究创建软件和硬件


这篇关于C# - 导出SQL Server CE .sdf文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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