在同一网络中的另一台计算机上保留SQL Compact Edition数据库时遇到的问题 [英] Problems faced in keeping SQL Compact Edition Database on another machine in same network

查看:83
本文介绍了在同一网络中的另一台计算机上保留SQL Compact Edition数据库时遇到的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为我的一个项目使用SQL CE 3.5,前端是WPF应用程序,它处理给定的文件并将数据转储到SQL CE数据库中.

I am using SQL CE 3.5 for one of my project, the front end is WPF application which process the given files and dumps the data to SQL CE database.

当前应用程序和数据库位于同一台计算机上.

Presently application and DB is on same machine.

客户希望他应该能够从网络上的任何计算机上运行应用程序,但数据库应保留在服务器的共享位置.

Client wants that he should be able to run the application from any machine on the network but database should remain on shared location of Server.

用户将在应用程序中选择SDF文件的路径,然后在处理任何文件时,应用程序会将数据转储到数据库.

User will select the path to SDF file in the Application and then when any file is processed application will dump the data to database.

我的问题是,如果将SDF文件保存在网络共享位置并从任何计算机访问它,那么它将正常工作还是会出现问题?

My question is, if keep SDF file on network shared location and access it from any machine then does it will work fine or could give problem?

推荐答案

实际上,这是不可能的-SQL CE不支持网络托管的操作:与sdf文件(临时数据)相关的所有内容都记录到本地机器,而不是网络源,因此服务器无法正确处理请求.

actually, it is not possible - SQL CE does not support network-hosted operations: everything related to the sdf-file (temp data) is recorded to the local machine, not network source, thus server is unable to process requests correctly.

您可以使用像数据存储一样的SQL Express Server,对于本地客户端,您唯一需要的就是Microsoft同步库2.1(它也可以与SQL CE 4.0 SP1一起使用)

You can use SQL Express Server that acts like data storage, for the local client the only thing you need is Microsoft Synchronization library 2.1 (it also works with SQL CE 4.0 SP1)

总结一下,创建SQL CE数据库,用表填充它,为它们建立索引,然后将其移植到SQL Server Express,将同步模块添加到您的应用程序(在单独的线程ofc中),就是这样.

Summarising, create the SQL CE database, fill it with tables, index them, then port it to SQL Server express, add sync module to your app (in a separate thread ofc) and that's it.

另一种解决方案是使用MS Access DB,它允许发生这种混乱,但是它的速度慢得令人难以置信,更不用说不允许同时写入数据库了.

Another solution is to use MS Access DB, which allows such mess, but it is incredibly slow not to mention no way to allow simultaneous writing to the db.

这篇关于在同一网络中的另一台计算机上保留SQL Compact Edition数据库时遇到的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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