以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  多文件列如何导出为一文件名一列  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=84946)

--  作者:大红袍
--  发布时间:2016/5/13 15:39:00
--  
Dim dt1 As DataTable = DataTables("资料目录")
Dim dt2 As DataTable = DataTables("文件管理表")
For Each dr As DataRow In dt2.DataRows
    output.show(dr("资料名称"))
    Dim fdr As DataRow = dt1.Find("资料 = \'" & dr("资料") & "\'")
    If fdr Is Nothing Then
        fdr = dt1.addnew
        fdr("资料") = dr("资料")
    End If
    fdr("资料名称") =  dr("资料名称").replace(chr(10), "").replace(chr(13), ",")
Next

--  作者:大红袍
--  发布时间:2016/5/13 16:56:00
--  

参考代码

 

Dim dt1 As DataTable = DataTables("资料目录")
Dim dt2 As DataTable = DataTables("文件管理表")
For Each dr As DataRow In dt2.DataRows
    For Each str As String In dr("资料名称").replace(chr(10), "").split(chr(13))
        Dim fdr As DataRow = dt1.Find("资料名称 = \'" & str & "\'")
        If fdr Is Nothing Then
            fdr = dt1.addnew
            fdr("资料名称") = str
        End If
        fdr("资料名称") = str
    Next
Next

 

不会做,就上传具体实例

[此贴子已经被作者于2016/5/13 17:12:48编辑过]

--  作者:大红袍
--  发布时间:2016/5/13 17:14:00
--  
Dim dt1 As DataTable = DataTables("资料目录")
Dim dt2 As DataTable = DataTables("文件管理表")
For Each dr As DataRow In dt2.Select("资料名称 is not null")
    For Each str As String In dr("资料名称").replace(chr(10), "").split(chr(13))
        Dim fdr As DataRow = dt1.Find("资料名称 = \'" & str & "\'")
        If fdr Is Nothing Then
            fdr = dt1.addnew
            fdr("资料名称") = str
        End If
        fdr("资料名称") = str
    Next
Next