你的部件图号字符型,字符应该用单引号,代码改为:
Dim Cols1() As String = {"试样编号"}
Dim Cols2() As String = {"试样编号"}
For Each dr1 As DataRow In DataTables("表A").Select("[部件图号] > '0'")
Dim dr2 As DataRow = DataTables("表B").Find("试样编号 = '" & dr1("试样编号") & "'")
If dr2 Is Nothing Then
dr2 = DataTables("表B").AddNew()
End If
For i As Integer = 0 To Cols1.Length -1
dr2(Cols2(i)) = dr1(Cols1(i))
Next
Next
当然你也可以修改此列的数据类型为整数型,这样就不用改代码了。
参考:
http://www.foxtable.com/help/topics/0102.htm
http://www.foxtable.com/help/topics/1647.htm