主要代码如下 RsHistory.Open "Select tbname From tbname Where tbname='d_u_bjml'", S_HFcn, 3 If Not RsHistory.EOF Then S_HFcn.Execute "delete from d_u_bjml" Conn.Execute "INSERT INTO OPENROWSET('Microsoft.Jet.OLEDB.4.0', '" & App.Path & "\HistoryFiles.tlb'; 'admin'; '', d_u_bjml) (bjbh,bjmc,lbmc,cgjg,xsjg1,xsjg2,xsjg3,kcsx,kcxx,dw,bjlb,bzhl,ly,Zydid) Select a.bjbh,a.bjmc,b.lbmc,a.cgjg,a.xsjg1,a.xsjg2,a.xsjg3,a.kcsx,a.kcxx,a.dw,a.bjlb,a.bzhl,a.ly," & Zydid & " as zydid From j_bjml a,j_bjlb b Where a.lbbh*=b.lbbh and a.ly='0'" End If RsHistory.Close HistoryFiles.tlb是ACCESS文件,改了后缀,S_HFCN是打开该文件的连接。 CONN是SQL SERVER的连接。
RsHistory.Open "Select tbname From tbname Where tbname='d_u_bjml'", S_HFcn, 3
If Not RsHistory.EOF Then
S_HFcn.Execute "delete from d_u_bjml"
Conn.Execute "INSERT INTO OPENROWSET('Microsoft.Jet.OLEDB.4.0', '" & App.Path & "\HistoryFiles.tlb'; 'admin'; '', d_u_bjml) (bjbh,bjmc,lbmc,cgjg,xsjg1,xsjg2,xsjg3,kcsx,kcxx,dw,bjlb,bzhl,ly,Zydid) Select a.bjbh,a.bjmc,b.lbmc,a.cgjg,a.xsjg1,a.xsjg2,a.xsjg3,a.kcsx,a.kcxx,a.dw,a.bjlb,a.bzhl,a.ly," & Zydid & " as zydid From j_bjml a,j_bjlb b Where a.lbbh*=b.lbbh and a.ly='0'"
End If
RsHistory.Close
HistoryFiles.tlb是ACCESS文件,改了后缀,S_HFCN是打开该文件的连接。
CONN是SQL SERVER的连接。