2016-08-01 57 views

回答

0

你的問題是非常非常通用的。在這兩種情況下,這都是一個樣本。

'Create a new datatable 
     Dim table2 As New DataTable 
     table2.Columns.Add("Name") 

'loop through your existing datatable - add the records to the columns you want 
    For Each dr As DataRow In Table1.Rows 
      Dim R As DataRow = dt.NewRow 
      R("Name") = dr("TABLE1_COLUMNNAME") 
      dt.Rows.Add(R) 
    Next 
'turn the new datatable into the datagridview. 
DataGridView1.DataSource = table2