i have the following piece of code. i fill a datatable with values and add it to a dataset and display then in a datagridview. i then have a msgbox, after this i fill the datatable with different values and display the new values in the datagridview.
the problem is it now displays the values from both tables.
how can i overwrite the datatable so that it only contains the values of the second table
the problem is it now displays the values from both tables.
how can i overwrite the datatable so that it only contains the values of the second table
VB.NET:
Dim ds As DataSet = New DataSet()
Dim dt As DataTable = New DataTable()
Dim queryAdapter As OleDb.OleDbDataAdapter = New OleDb.OleDbDataAdapter("SELECT * FROM table1", conn)
ds.Tables.Add(dt)
queryAdapter.Fill(dt)
grid1.DataSource = ds.Tables(0).DefaultView
MsgBox("")
Dim queryAdapter2 As OleDb.OleDbDataAdapter = New OleDb.OleDbDataAdapter("SELECT * FROM table2", conn)
queryAdapter2.Fill(dt)
grid1.DataSource = ds.Tables(0).DefaultView