DataTable.Select and Performance Issue in C#

后端 未结 6 2090
误落风尘
误落风尘 2020-12-15 01:56

I\'m importing the data from three Tab delimited files in the DataTables and after that I need to go thru every row of master table and find all the rows in two child tables

6条回答
  •  悲&欢浪女
    2020-12-15 02:19

    Have you ran it through a profiler? That should be the first step. Anyhow, this might help:

    • Read the master text file into memory line by line. Put the master record into a dictionary as the key. Add it to the dataset (1 pass through master).

    • Read child text file line by line, add this as a value for the appropriate master record in the dictionary created above

    • Now you have everything in the dictionary in memory, only doing 1 pass through each file. Do a final pass through the dictionary/children and process each column and perform final calcs.

提交回复
热议问题