Dim dt As New DataTable Dim r As DataRow With dt .Columns.Add("HoleNo", GetType(String)) .Columns.Add("Depth_From", GetType(Double)) .Columns.Add("Depth_To", GetType(Double)) r = .NewRow : r(0) = "A1" : r(1) = 12 : r(2) = 14 : .Rows.Add(r) r = .NewRow : r(0) = "A1" : r(1) = 2 : r(2) = 6 : .Rows.Add(r) r = .NewRow : r(0) = "A1" : r(1) = 3 : r(2) = 5 : .Rows.Add(r) r = .NewRow : r(0) = "A1" : r(1) = 4 : r(2) = 6 : .Rows.Add(r) .DefaultView.Sort = "[HoleNo] ASC, [Depth_From] ASC, [Depth_To] ASC" End With dgv1.DataSource = dt.DefaultView

12,622,652 members (28,475 online)

Email

Password

Sign in using

I have two tables as I have already shown.

Table A

HoleNo Depth_from Depth_to

A1 1 2

A1 3 4

A1 5 6

Table B

HoleNo Depth_from Depth_to

A1

A1

A1

Now How do I update table B so that it looks like table A

Note that no changes must be made to table A.