Sync Framework 2.0 错误:不支持指定的更改跟踪操作

发布于 2024-09-15 08:50:06 字数 603 浏览 7 评论 0原文

我对 MS Sync 框架相当陌生,并且已经在墙上撞了大约四个小时,但毫无结果。我只是想将我的数据库(一个“主”SQL Server 2008 与 SQL Server CE(客户端))同步:

Dim syncAgent As DataCacheSyncAgent = New DataCacheSyncAgent()
Dim syncStats As Microsoft.Synchronization.Data.SyncStatistics = syncAgent.Synchronize()

它在 Visual Studio 2010 中工作得很好并且始终能够同步,但现在我正在尝试在我客户的计算机上实现它时,我总是收到错误:

不支持指定的更改跟踪操作。要对表执行此操作,请禁用表的更改跟踪,然后启用更改跟踪。

我已经尝试了所有我能想到的方法,但都无济于事,但就像我说的,我是同步框架的新手,在谷歌上没有找到太多帮助。我尝试过关闭并重新打开更改跟踪(通过 SQL Mgmt Studio 在服务器上),但这也不起作用。也许这意味着我应该把它关掉&回到客户端?我如何以编程方式完成该任务?

I'm fairly new to the MS Sync framework and have been beating my head against the wall for about four hours now to no avail. I'm simply trying to sync my databases (one "master" SQL Server 2008 with a SQL Server CE, the client) with:

Dim syncAgent As DataCacheSyncAgent = New DataCacheSyncAgent()
Dim syncStats As Microsoft.Synchronization.Data.SyncStatistics = syncAgent.Synchronize()

It works just fine in Visual Studio 2010 and always manages to sync, but now that I'm trying to implement it on my client's computers, I always get the error:

The specified change tracking operation is not supported. To carry out this operation on the table, disable the change tracking on the table, and enable the change tracking.

I've tried everything that I can think of to no avail, but like I said I'm new to the sync framework and haven't found much help on Google. I've tried turning change tracking off and back on (on the server via SQL Mgmt Studio), but that didn't work either. Perhaps it meant I should turn it off & back on in the client? How might I accomplish that programmaticly?

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

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

发布评论

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

评论(1

冷了相思 2024-09-22 08:50:06

经过大量搜索并把头撞到墙上后,修复出奇地简单。发生此错误时需要执行的操作是将解决方案的 .sdf“复制到输出目录”属性设置为“不复制”,并删除数据目录中可能已存在的文件。然后,同步框架将在首次加载时自动构建数据库。实际上很酷。我在网上注意到这个问题很多,但没有真正的答案&错误描述毫无帮助,所以我希望这篇文章对某人有所帮助。虽然我仍然有一个问题,但我认为最好将其放在另一个问题中。

After much searching and beating my head against the wall, the fix was surprisingly simple. What needs to happen when this error occurs is to set your solution's .sdf Copy to Output Directory property to "Do not Copy" and delete the one that may already be in your data directory. The sync framework will then automatically build your database on first load. Pretty cool actually. I noticed this question A LOT on the web, but no real answers & the error description was anything but helpful, so I hope that this post helps someone. I'm still having one issue though, but I think that is best placed in another question.

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