Dim dlg As new OpenFileDialog
If dlg.ShowDialog = DialogResult.OK Then
Dim txt As String = FileSys.ReadAllText(dlg.FileName, Encoding.Default)
Dim idx1 As Integer = txt.IndexOf("<YKFP>")
Dim idx2 As Integer = txt.IndexOf("</YKFP>")
Dim xmlDoc As New System.XML.XmlDocument
xmlDoc.Loadxml(txt.Trim)
Dim ndList = xmlDoc.GetElementsByTagName("Row")
For Each dr As object In ndlist
Dim ndr As DataRow = DataTables("表A").find("第一列 = '" & dr.Attributes("fa piao号码").value & "'And 第二列 = '" & dr.Attributes("fa piao号码").value & "'")
If ndr Is Nothing Then ndr = DataTables("表A").addnew
ndr("第一列") = dr.Attributes("fa piao代码").value
ndr("第二列") = dr.Attributes("fa piao号码").value
ndr("第三列") = dr.Attributes("客户识别号").value
'Dim str = dr.Attributes("开piao日期").value
'ndr("第四列") = str.SubString(0,4) + "-" + str.SubString(4,2) + "-" + str.SubString(6,2)
ndr("第四列") = dr.Attributes("开piao日期").value
ndr("第五列") = dr.Attributes("合计金额").value
ndr("第六列") = dr.Attributes("税额").value
ndr("第七列") = dr.Attributes("fa piao状态").value
Next
End If
这样写代码可以导入数据了,但是怎么解决它的重复导入呢?