{
.首先要安装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.