Do ADO.Net DataTables have indexes?

前端 未结 11 2187
别那么骄傲
别那么骄傲 2021-01-01 15:11

I am using VSTS 2008 + C# + .Net 3.5 + SQL Server 2008 + ADO.Net. If I load a table from a database by using a DataTable of ADO.Net, and in the database table, I defined a c

11条回答
  •  余生分开走
    2021-01-01 15:41

    I had the same problem with many queries from a large datatable that are not according to the primary key.

    The solution I found was to create DataView for each index I wanted to use, and then use it's Find and FindRows methods to extract the data.

    DataView creates an internal index on the DataTable and behaves virtually as an index for this purpose.

    In my case I was able to reduce 10,000 queries from 40 Seconds to ONE!!!

提交回复
热议问题