I always seem to use Get when working with data (strongly typed or otherwise) from the database and I have never really needed to use Fill although I just as easily could use Fill instead of get when pulling out and updating data.
Can anyone provide guidance as to the implications and gotchas of each method?
In what situations is it preferable to use one or the other?
Any performance implications?
Thanks in advance for the answers! I love this community!
A particular gotcha of Fill, if the table already contains data is that you could get unique index exceptions when, for example, the query returns a row whose primary key is already in the table.
I've worked with a lot of data-bound Windows Forms code where edit controls or a grid on the form is bound to a table and then Fill is used to load more rows from the database to the table. This can cause some interesting event firing sequences and intermittent errors from experience.
Using Get to retrieve a new table with the new results then rebinding the form to the new table can avoid situations like this.
I doubt there is much performance difference between the two unless using Fill on a table with existing rows. In this case the table's BeginLoadData method is ignored which would normally have delayed event firing and index rebuilding until the end.