Rss & SiteMap
Foxtable(狐表) http://www.foxtable.com
谢谢mr725老师!
能者为师,,这段代码我搞了二天也没搞出来,就是没想到复制为文本再提取,有时候就是这么笨,呵呵
这个好,呵
我参考楼主的代码:
改成这样:
Dim tt1 as string
Dim tt2 as string
For Each c As DataCol In DataTables("表B").DataCols
tt1 = tt1 & "|" & c.name
tt2 = tt2 & "|" & c.Caption
Next
Dim Values1() as String
Dim Values2() as String
Values1 = tt1.split("|")
Values2 = tt2.split("|")
Dim dr1 As DataRow = DataTables("表A").AddNew()
Dim dr2 As DataRow = DataTables("表A").AddNew()
Dim n as integer
For Each cl As DataCol In DataTables("表A").DataCols
IF Values1.Length > (n+1) Then
dr1(cl)=tt1.split("|")(n+1)
dr2(cl)=tt2.split("|")(n+1)
n=n+1
ELSE
dr1(cl)=Nothing
dr2(cl)=Nothing
END IF
Next
For Each dt As DataTable In DataTables
For Each dc As DataCol In dt.DataCols
Dim dr As DataRow = DataTables("表A").AddNew()
dr("表名")=dt.Name
dr("表标题")=dt.caption
dr("列名")=dc.Name
dr("列标题")=dc.caption
Next
Next
如果是:一次就把项目中所有表名、表标题、列名、列标题全部填入到表A,请问怎样改写以下代码Dim tt1 as string
Dim tt2 as string
For Each c As DataCol In DataTables("表B").DataCols
tt1 = tt1 & "|" & c.name
tt2 = tt2 & "|" & c.Caption
Next
Dim Values1() as String
Dim Values2() as String
Values1 = tt1.split("|")
Values2 = tt2.split("|")
Dim dr1 As DataRow = DataTables("表A").AddNew()
Dim dr2 As DataRow = DataTables("表A").AddNew()
Dim n as integer
For Each cl As DataCol In DataTables("表A").DataCols
IF Values1.Length > (n+1) Then
dr1(cl)=tt1.split("|")(n+1)
dr2(cl)=tt2.split("|")(n+1)
n=n+1
ELSE
dr1(cl)=Nothing
dr2(cl)=Nothing
END IF
Next