5. Working with a Database : How You Can Access a Database with DataStream Objects : How You Can Use Query Objects : How You Can Delete Data with a Query Object
 
Share this page                  
How You Can Delete Data with a Query Object
Deleting data with a query object is more complicated than updating it. After removing the deleted row from the database, the code must check whether any rows remain in the cached data set.
For example, assume the data set originally contained four rows and the user just deleted the third row. After the third row is deleted from the cache, the fourth row becomes the third row and CurRow becomes 3. You can display this row directly by invoking the Load method. Note that you do not want to invoke the NextRow method because the deletion from the cache automatically performs that operation.
Assume instead that the user deleted the fourth and last row in the cache. In this case, you do not want to invoke the Load method because there is no current row. Instead, you want to make the current row point to an actual row.