有点甜老师 在项目中使用下面的内容是否可以实现你说的第三点思路呢?
但是感觉这个思路比较不便于操作
FTP上报数据
如果没有条件搭建SQL Server服务器,那么也可以考虑通过FTP实现远程数据上报。
1、将需要上报的数据生成一个Access文件,并上传到FTP服务,例如将当天订单上报:
'导出当天订单
Dim ex As New Exporter
ex.SourceTableName = "订单"
ex.FilePath = "c:\temp\gd.mdb"
ex.Filter = "日期 = #" & Date.Today & "#"
If FileSys.FileExists(ex.FilePath) Then '如果目标文件已经存在
FileSys.DeleteFile(ex.FilePath) '则删除之
End If
ex.Export()
'上传到FTP服务器
Dim ftp1 As new ftpclient
ftp1.host="ftp.baidu.com"
ftp1.Account = "foxtable"
ftp1.password = "168168"
ftp1.upload(ex.FilePath,"/gd.mdb",True) '上传
2、总部接收数据的代码:
'下载上报数据
Dim ftp1 As new ftpclient
ftp1.host="ftp.baidu.com"
ftp1.Account = "foxtable"
ftp1.password = "168168"
If ftp1.FileExists("/gd.mdb") = False Then
MessageBox.Show("广东分公司还未上报今天数据","提示")
Return
End If
ftp1.Download("/gd.mdb","c:\temp\gd.mdb") '下载ftp上的上报文件
ftp1.Delete("/gd.mdb") '下载成功后删除ftp上的上报文件.
'合并上报数据
Dim mg As New Merger
mg.SourcePath = "c:\temp\gd.mdb"
mg.SourceTableName = "订单"
mg.DataTableName = "订单"
mg.Merge()
Filesys.DeleteFile("c:\temp\gd.mdb") '合并后删除下载文件
[此贴子已经被作者于2014-9-22 17:26:08编辑过]