xmail123

xmail123

  • NA
  • 10
  • 0

How to refresh the DataSet after a data source update

Jul 2 2004 12:04 PM
After updating my data source using the DataAdapter.Update method I want to refresh the DataSet by repopulating it. There are apparently 2 approaches to accomplishing this. Approach 1 Refresh a dataset manually by calling an adapter's Fill method after calling its Update method. When I call the fill after the update the rows are appended to the data table. The data table is not over written as I expected. I have to do a Clear then the Fill. Is there something I am missing that is preventing the data table from being over written or is explicitly calling a Clear first the correct way to do this? Approach 2 Alternatively, you can configure the data adapter to automatically execute an SQL SELECT statement or stored procedure after performing the Update. In that case, the data adapter creates two SQL statements for the UpdateCommand and InsertCommand objects. The first statement executes the update, and the second statement is a SELECT statement designed to refresh the dataset. 1. I don't see a property or something in the data adapter to enable the automatically execute of an SQL SELECT statement or stored procedure after performing the Update. 2. In order for the second SELECT statement to execute, the data source must support batch queries as in SQL Server. How do I set that up?

Answers (1)