Fastest way to read data from MySQL using C#
I'm wondering if there is a faster method than using something like:
while (Reader.Read())
to read the results of mysql select queries.
I'm randomly pulling 10,000 rows from a database and would like to read it as quickly as possible. I开发者_高级运维s there a way to serialize the results if we know what they are (such as using the metadata to setup a structure)?
Try MySQLDataAdapter.Fill
method to fill any DataTable
object - read speed is comparable to optimal usage of read data with Read
method (depends on your while block reading way) and main advantage is that you achieve prepared data collection which you can manage or just write to XML file.
精彩评论