I have a large dataset (over 100,000 records) that I wish to load into a DataGridView. The stored procedure that does this can take 10 seconds or more to complete.
So far I have a BackgroundWorker preventing the UI from locking up, and have implemented a rudimentary 'Please Wait' dialog.
What I'd like to do is somehow populate the DataGridView with results as they get returned from the database somehow. The best way to describe it is how the SQL Server Management Studio does it - when a query runs, rows come back immediately even though the query is still executing. There's also a button to stop the query and keep the rows that have been returned.
How can I do this in my own code?
The DataGridView is only used to display the rows of data, and then the user clicks one to do something else. Nothing gets written back to the database.