I'm using radgridview
in C# winform application to show data from database. I'm also altering database through ADO.Net. The problem is after I change the database, for example by deleting a row or adding a new row, changes do not appear in gridview.
I also want to mention that I have bound database to gridview through smart tags and when I tried to create a new dataset and assign it to radgridview1.datasource
I got tons of errors.
Any suggestion on how can force radgridview
to reload it's datasource
?
Well, I found the answer myself. Although it only works on dataGridView
and doesn't work on dataListView
.
To delete a record and commit changes to database :
radGridView1.CurrentRow.Delete();
this.yourTableAdapter.Update(yourDataSet);
On the other hand, if you have added new records and you want to reform the list :
this.yourTableAdapter.Fill(yourDataSet.yourTabel);
If you know how to do the same with dataListView
, I'll be glad to hear.