在删除时统一加上条件判断后面的列不是空的才删除
If nd IsNot Nothing Then
Dim pth() As String = nd.FullPath.Split("\")
Select Case nd.Level
Case 0
DataTables("表A").DeleteFor("大类 = '" & pth(0) & "' and 第四列 is null and 第五列 is null")
Case 1
DataTables("表A").DeleteFor("大类 = '" & pth(0) & "' And 二类 = '" & pth(1) & "' and 第四列 is null and 第五列 is null")
Case 2
DataTables("表A").DeleteFor("大类 = '" & pth(0) & "' And 二类 = '" & pth(1) & "' And 三类 = '" & pth(2) & "' and 第四列 is null and 第五列 is null")
End Select
nd.Delete()
End If