Visual Basic .NET help with datasets/datatable/datagrid please?

EmperorIQ

Platinum Member
Sep 30, 2003
2,003
0
0
Hi, Here is how the app runs: I want to display a table. Sometiimes updates are made to the sql database where rows are removed or added onto the table. In order to show the datatable with the updated sql database I perform this action.

dataset.tables.item(0).clear()
'perform sql queries
'make a connection and run query

SqlDataAdapter.SelectCommand = New SqlCommand(x,x)
SqlDataAdapter.Fill(dataset.tables.item(0))

Fill works great, but it only adds or refreshes rows to the datatable, doesn't remove.

problem: Whenever I use clear() on the datatable, or delete() [to delete individual rows] then try to refresh the datagrid with datagrid.refresh(), my datagrid on the windows form flickers and everything is reset. ie the scroll bar is back at top and whatever row was selected is now unselected.

Question: Does anyone know any other methods to overwrite a current datatable with data with a new set of data?

Thanks in advance.
 

EmperorIQ

Platinum Member
Sep 30, 2003
2,003
0
0
simplified question, you don't have to read above> Is there a way to synch database and datatable without clearing the datatable with refilling with sqldataadapter?