如何使用asp.net同步数据库 [英] How to synchronize the database using asp.net

查看:96
本文介绍了如何使用asp.net同步数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好

我需要自动同步两个SQL Server数据库.当在服务器数据库的特定表中发生某些插入/更新/删除操作时,应该将其反映在客户端数据库中.该怎么办?
我需要一个示例来同步两个数据库之间的表.





问候

Bala

Hi All

I need to synchronise two sql server databases automatically. When some insetion/updation/deletion happens in the particular table of Server database it should be reflected in the client database.How to do that?
I need a sample to synchronise the tables between two databases.





Regards

Bala

推荐答案

尝试这个希望它能运行TSQL

-与tbl_users同步tbl_users2
Try this One Hope it will work TSQL

--Syncronize tbl_users2 with tbl_users
insert into tbl_users2 (UserName,Email)
select UserName,Email  from tbl_users except
select UserName,Email from tbl_users2

-- repeat this process but in reverse order.
--Syncronize  tbl_users with tbl_users2
insert into tlb_users (UserName,Email)
select UserName,Email  from tbl_users2 except
select UserName,Email from tbl_users



-此命令返回tbl_users中存在但不存在的所有行
--in tbl_users2



--this commands returns all the rows which exist in tbl_users but do not exists
--in tbl_users2

select UserName,Email  from tbl_users except
select UserName,Email from tbl_users2





--this commands returns all the rows which exist in tbl_users2 but do not exists
--in tbl_users





select UserName,Email  from tbl_users2 except
select UserName,Email from tbl_users


这篇关于如何使用asp.net同步数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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