sql server复制编程
详细页面:http://www.verydemo.com/demo_c155_i24290.html
{
.首先要安装ActivX控件:component->import activex control->microsoft sql merge control 8.0(version 1.0)-> install
.sql server、oracle 等大型DBMS都提供复制功能。且复制可以在异种DB间进行。可以说非常具有通用性。
.本例:服务器端安装SQL SERVER2000,收银机安装ACCESS2000,合并复制方式。
.采用在客户端编程的方式,把一些设置放在指定的INI文件中,灵活而方便。
}
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, OleCtrls, SQLMERGXLib_TLB, StdCtrls, Buttons;
type
TForm1 = class(TForm)
merge: TSQLMerge;
BitBtn1: TBitBtn;
procedure BitBtn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
//在客户端放置一个“同步”按钮
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
try
with merge do
begin
//发布服务器
Publisher := 'cxg'; //出版服务器名
PublisherDatabase := 'ynckjxc'; //发布数据库
Publication := 'distribute'; //发布
PublisherSecurityMode := NT_AUTHENTICATION; //安全验证
//分发服务器
Distributor := 'cxg'; //分发服务器名
DistributorSecurityMode := NT_AUTHENTICATION;
//订阅服务器
Subscriber := 'cxg'; //订阅服务器名
SubscriberDatabasePath := 'c:/data/ynjxc.mdb'; //订阅数据库
SubscriberDatasourceType := JET4_DATABASE;
SubscriberSecurityMode := DB_AUTHENTICATION;
SubscriberLogin := 'admin';
SubscriberPassword := '';
//订阅方式
SubscriptionType := ANONYMOUS; //匿名订阅
SynchronizationType := AUTOMATIC;
//发布服务器和订阅服务器间双向同步
Initialize;
Run;
Terminate;
end;
showmessage('成功');
except
showmessage('失败');
end;
end;
end.
.首先要安装ActivX控件:component->import activex control->microsoft sql merge control 8.0(version 1.0)-> install
.sql server、oracle 等大型DBMS都提供复制功能。且复制可以在异种DB间进行。可以说非常具有通用性。
.本例:服务器端安装SQL SERVER2000,收银机安装ACCESS2000,合并复制方式。
.采用在客户端编程的方式,把一些设置放在指定的INI文件中,灵活而方便。
}
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, OleCtrls, SQLMERGXLib_TLB, StdCtrls, Buttons;
type
TForm1 = class(TForm)
merge: TSQLMerge;
BitBtn1: TBitBtn;
procedure BitBtn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
//在客户端放置一个“同步”按钮
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
try
with merge do
begin
//发布服务器
Publisher := 'cxg'; //出版服务器名
PublisherDatabase := 'ynckjxc'; //发布数据库
Publication := 'distribute'; //发布
PublisherSecurityMode := NT_AUTHENTICATION; //安全验证
//分发服务器
Distributor := 'cxg'; //分发服务器名
DistributorSecurityMode := NT_AUTHENTICATION;
//订阅服务器
Subscriber := 'cxg'; //订阅服务器名
SubscriberDatabasePath := 'c:/data/ynjxc.mdb'; //订阅数据库
SubscriberDatasourceType := JET4_DATABASE;
SubscriberSecurityMode := DB_AUTHENTICATION;
SubscriberLogin := 'admin';
SubscriberPassword := '';
//订阅方式
SubscriptionType := ANONYMOUS; //匿名订阅
SynchronizationType := AUTOMATIC;
//发布服务器和订阅服务器间双向同步
Initialize;
Run;
Terminate;
end;
showmessage('成功');
except
showmessage('失败');
end;
end;
end.
相关推荐
SoarFly00 2020-02-11
OwenJi 2019-12-02
leodengzx 2019-12-01
Westdoor 2019-08-25
lovelily 2014-12-15
ROES 2016-06-17
编程相关文章收集 2014-05-30
liboxue 2009-09-16
王道立心 2019-06-29
xasdfg 2015-05-06
baihehua00 2011-12-09
ARCHYang 2015-11-29
ARCHYang 2013-05-31
aluminiumfoil 2011-07-07
服务器端攻城师 2018-12-06
missshy 2018-12-05
JESSIEfoo 2018-09-12
奶牛老爹 2012-09-25