数据库实时同步技术解决方案

else

txtfile.writeline(\远程数据库连接失败 ! ***** \ end if else

txtfile.writeline(date&\\ end if

releaseconnection conn_ora releaseconnection conn_local

set f=nothing set txtfile=nothing set rs_local=nothing set rs_ora=nothing 间隔 5分钟循环一次

!!!! ####### 网络故障WScript.Sleep 300000 Loop

------------- 数据同步过程 ----------------------------------------- Sub xcopy() dim records

(0) ------ 判断 temp 是否存在,存在则删除

sql_local=\name=temp and xtype=U\

rs_local.open sql_local,conn_local,1,1

records=rs_local(\

rs_local.close if records > 0 then

sql_local=\

rs_local.open sql_local,conn_local,1,1 end if

(1) ------ 取当前日期前Nday天的数据插入临时表 temp sql_local=\

OPENROWSET(MSDAORA.1,hydata;qyselect;qy08select12,SELECT * FROM

Hybjsb.V_QY_CKLSZ) \

sql_local=sql_local+\

CONVERT(smalldatetime,dbilldate)<=\CONVERT(smalldatetime,dbilldate)>= \

sql_local=sql_local+\曲烟寄售库 \

rs_local.open sql_local,conn_local,1,1 (2) ------ 判断是否有新记录

sql_local=\

sql_local=sql_local+\

sql_local=sql_local+\where bid not in (select bid from \lyrq>=\

rs_local.open sql_local,conn_local,1,1

records=rs_local(\

rs_local.close

if records > 0 then ---- 有新记录, 追加记录

sql_local=\

sql_local=sql_local+\classcode,invclassname,chbm,lybjmc,lygg,lyxh,lyjh,graphid,lydw,lysl,lydj,lyje)\

sql_local=sql_local+\

sql_local=sql_local+\

dbilldate,billcode,storname,deptname,psnname,custname,invclasscode,invclassname,invcode,invname,invspec,invtype,invmnecode,graphid,measname,noutnum,nprice,noutmny\

sql_local=sql_local+\

sql_local=sql_local+\\lyrq>=\

rs_local.open sql_local,conn_local,1,1

txtfile.writeline(\

txtfile.writeline(\--- \new Add \记录.\ else

txtfile.writeline(\

txtfile.writeline(\--- no new data! \

联系客服:779662525#qq.com(#替换为@) 苏ICP备20003344号-4