Dim dr1,dr2 As DataRow
Dim cmd As New SQLCommand
Dim dt1,dt2 As DataTable
''cmd.Connection Name = "region" '据实填写
cmd.CommandText = "SELECT * From {AA}" '据实填写
dt1 = cmd.ExecuteReader()
dt2 =DataTables("AA") '据实填写
dt2.StopRedraw
dt2.DataRows.Clear
For Each s1 As String In dt1.GetValues("编码")
dr1=dt2.AddNew
For Each dc As DataCol In dt2.DataCols
If dc.name = "编码" Then
dr1( dc.name ) = s1
Else
dr2=dt1.Find("编码 = '" & s1 & "' And " & dc.name & " > '' ")
If dr2 IsNot Nothing Then
dr1( dc.name ) = dr2( dc.name )
End If
End If
Next
Next
dt2.ResumeRedraw
[此贴子已经被作者于2014-8-22 15:59:01编辑过]