Hi I have a Populated Generic List in a winform and now wanna to send its data into a SQL server table as a bulk Copy. As I read the SqlBulkCopy Class, it needs a data reader as a source.
Now, how can I convert it to a DataReader?
If the data-volume is sane enough to exist as a
List<T>, you might as well just construct a
DataTable and push the data in that way. I don't like
DataTable, but it does this job nicely. The alternative would be to write a custom
IDataReader implementation like this, but which iterates over the items in the list each time. I'm not sure it is worth the effort.