If dlg.ShowDialog = DialogResult.Ok Then For Each file As String In FileSys.GetFiles(dlg.SelectedPath) Dim finfo As new FileInfo(file) Dim fdr As DataRow = DataTables("表A").Find("第一列 = '" & finfo.Name.replace(finfo.Extension, "") & "'") If fdr Is Nothing Then fdr = DataTables("表A").AddNew fdr("第一列") = finfo.Name.replace(finfo.Extension, "") End If fdr("第三列") = finfo.Name FileSys.CopyFile(file, ProjectPath & "Attachments/" & finfo.name) Next End If