如下代码
Select Case e.DataCol.name
Case "单号"
'Dim cmd As New SQLCommand
'Dim dt As DataTable
'cmd.C
'cmd.CommandText = "Select * From {A} Where [单号] = '" & e.NewValue & "'"
If e.DataTable.Find("单号= '" & e.NewValue & "' and _Identify <> " & e.DataRow("_Identify")) Is Nothing Then
Dim nma() As String = {"单号"} 'A表数据来源列
Dim nmb() As String = {"指令号"} 'B表数据接收列
Dim dr As DataRow = DataTables("B").AddNew
For i As Integer = 0 To nma.Length - 1
dr(nmb(i)) = e.DataRow(nma(i))
Next
MainTable =Tables("B")
End If
End Select