数据库实时同步技术解决方案 下载本文

Set net = CreateObject(\

If Not fso.DriveExists(fso.GetDriveName(Path)) Then err.clear

On Error Resume Next 出错不显示,执行下一条

net.MapNetworkDrive Path, source_path,False,\ if err.number=0 then

txtfile.write(\映射成功! \ -------------------- 执行拷贝

source_file=path&\ err.clear

On Error Resume Next 出错不显示,执行下一条 fsofile.copyfile source_file,target_file

net.RemoveNetworkDrive Path,True ------ 取消映射

else

txtfile.write(\映射失败! \ end if End If

If Err.Number<>0 Then

txtfile.writeline(\失败! \else

txtfile.writeline(\成功! \end if

set fso=nothing set fsofile=nothing set net=nothing end sub *****

========== MDB TO SQLSERVER实时同步过程==========

sub MDBTOSQL(database,textfile1,ip) Dim Path,fso,fsofile,net num=right(ip,2)

db=\db=trim(database) Err.clear

on error resume next conn1 =

\SOURCE=local;UID=sa;PWD=sa;DATABASE=\

set rs = createobject(\--------- insert arrange 插入操作 ---------------- sql=\

sql=sql+\e,cigbrand,tradetype,arrangenum,downnum,printnum,\sql=sql+\

sql=sql+\

sql=sql+\e,cigbrand,tradetype,arrangenum,downnum,printnum,\

sql=sql+\openrowset(Microsoft.Jet.OLEDB.4.0,\

sql=sql+\arrange) \

sql=sql+\\rs.open sql,conn1,1,1 rs.close

-------- update arrange 更新操作 ---------------- sql=\sql=sql+\

a.printnum=b.printnum,a.applynum=b.applynum,a.planfinishflag=b.planfinishflag,a.sendbackflag=b.sendbackflag,a.confirmflag=b.confirmflag \

sql=sql+\

sql=sql+\

D:\\web\\barcodeprinter\\backup\\\sql=sql+\sql=sql+\

convert(char(10),a.barrangedate,120)>convert(char(10),getdate()-7,120)\

rs.open sql,conn1,1,2 rs.close

------- delete history arrange 删除操作 ------- sql=\convert(char(10),barrangedate,120) < convert(char(10),getdate()-365,120)\sql.open sql,conn1,1,2 rs.close

---------------------------------------

五、 结束语