以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  如何快速把 一个表的数据 更新到 另一个表上  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=82922)

--  作者:ljh29206
--  发布时间:2016/3/28 9:56:00
--  如何快速把 一个表的数据 更新到 另一个表上
DataTables("AttCard").LoadFilter = " CrdDate > \'" & Date.Today.AddMonths(-1) & "\'"
DataTables("AttCard").Load

DataTables("fstbfc_AttRecord").LoadFilter = " CrdDate > \'" & Date.Today.AddMonths(-1) & "\'"
DataTables("fstbfc_AttRecord").Load

For Each dr As Row In Tables("fstbfc_AttRecord").Rows
dr.Delete
Next

For Each dr As Row In Tables("AttCard").Rows
Dim dradd As Row = Tables("fstbfc_AttRecord").Rows.AddNew
For Each drcol As Col In Tables("AttCard").Cols
dradd(drcol.Name) =dr(drcol.Name)
Next
Next

代码如上,把一个数据库的表更新到另一个数据库上,  表的结构一样
行数每次都有20000行

如果按照上边的代码走,很慢.....

有没更好的方法?

--  作者:大红袍
--  发布时间:2016/3/28 10:09:00
--  

方法一:Filler

 

http://www.foxtable.com/help/topics/0680.htm

 

方法二:直接用sql语句

 

Insert into Table2(a, c, d) select a,c,5 fr om Table1 Where 条件

 

执行完毕以后,重新Load一下表格加载进来显示即可

 


--  作者:ljh29206
--  发布时间:2016/3/28 10:17:00
--  
DataTables("fstbfc_AttRecord").LoadFilter = " CrdDate > \'" & Date.Today.AddMonths(-1) & "\'"
DataTables("fstbfc_AttRecord").Load

For Each dr As Row In Tables("fstbfc_AttRecord").Rows
dr.Delete
Next

除了 这个方法 有没更快的 对
DataTables("fstbfc_AttRecord").LoadFilter = " CrdDate > \'" & Date.Today.AddMonths(-1) & "\'"
DataTables("fstbfc_AttRecord").Load
的加载行 全部清除?

--  作者:大红袍
--  发布时间:2016/3/28 10:17:00
--  

用sql语句

 

http://www.foxtable.com/help/topics/0689.htm

 


--  作者:大红袍
--  发布时间:2016/3/28 10:18:00
--  

这样写也可以

 

http://www.foxtable.com/help/topics/2899.htm