以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 关于复制记录到别一个表的问题 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=103180) |
-- 作者:fntfgz -- 发布时间:2017/7/2 9:06:00 -- 关于复制记录到别一个表的问题 我想在当前表选定行下面的75行记录复制到另外一个表“本二志愿”,不管我选定第几行,总会把当前表的第一行记录复制过去,请老师帮我看看代码,问题出在哪里呀? Dim bm As String=CurrentTable.Name Dim r As Row = Tables(bm).Current Dim i As Integer Dim j As Integer=0 i=r.Index DataTables("本二志愿").DeleteFor("_Identify>0") DataTables("本二志愿").save() For Each dr2 As Row In Tables(bm).Rows If (dr2.Index>= i And dr2("计划_今年")>0 And j<75) Then Dim nr As DataRow = DataTables("本二志愿").AddNew() For Each dc As DataCol In DataTables(bm).DataCols nr(dc.name) = dr2(dc.name) Next j=j+1 \'i=dr2.Index End If Next DataTables("本二志愿").save() MainTable=Tables("本二志愿") |
-- 作者:有点甜 -- 发布时间:2017/7/2 14:43:00 -- Dim t As Table = CurrentTable DataTables("本二志愿").DeleteFor("") Dim count As Integer = iif(t.current.index+75<t.rows.count, t.current.index+75, t.rows.count-1) For i As Integer = t.Current.Index+1 To count Dim r As Row = t.rows(i) Dim nr As DataRow = DataTables("本二志愿").AddNew() For Each dc As Col In t.Cols nr(dc.name) = r(dc.name) Next Next DataTables("本二志愿").save() MainTable=Tables("本二志愿") |