合并sql server ce数据库 [英] Merge sql server ce databases

查看:51
本文介绍了合并sql server ce数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们能否创建一个 WCF 服务来合并后台线程中的 sqlserverce 数据库.我有一个 GUI,它从网络和事件处理程序的各种目录中选择一组 sdf 数据库到 cmd,以便在日期范围之间合并这些目录中的数据库.sdf 数据库的结构在所有目录中都是相同的.

Could we create a WCF Service to merge sqlserverce databases in background thread. I have GUI which selects a set of sdf databases from various directories in a network and event handler to cmd for merge the databases in those directories between the range of dates. The structure of the sdf databases are same in all the directories.

推荐答案

好吧...我试图对我的评论开玩笑,但我会提供更好的答案.

Okay...I was trying to be funny with my comment but I will provide a better answer.

我不知道有什么魔法"命令可以将数据库与 C# 代码合并在一起.您可以编写自己的逻辑来合并数据库.代码看起来像这样.

I don't know of any "magic" command to merge databases together with C# code. You could write your own logic to merge databases. The code would look something like this.

  • 从数据库中获取表列表.
  • 遍历表列表并获取元数据
  • 添加逻辑以跳过任何只读列,例如标识列和计算字段
  • 从源表中获取数据
  • 将数据写入目标表

我真的需要更多的信息来帮助更多.例如,

I would really need much more information to help any more then this. For example,

  • 您是将所有数据库合并到一个原始数据库中,还是创建一个全新的数据库,其中包含来自所有数据库的所有数据?
  • 您需要先创建目标数据库还是它已经存在?
  • 如果已经存在,是否需要清理数据库中已经存在的数据?

一旦您编写了执行合并的逻辑,您就可以选择如何调用代码..Net 提供从 Web 服务调用逻辑的能力,并提供在后台线程中运行代码的方法.您可以通过多种方式实现此功能.

Once you write the logic to do the merge, how you call the code is your choice. .Net provides the capability to call the logic from a Web Service and it provides the means to run the code in a background thread. You can implement this functionality in a variety of ways.

这篇关于合并sql server ce数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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