我有一個(gè)非常慢的方法,我不確定如何優(yōu)化此方法。我也不太了解LINQ的工作原理,因此,如果解決方案是使用LINQ,請(qǐng)解釋一下。非常感謝。該dtExcel方法的參數(shù)中的DataTable包含第一部分?jǐn)?shù)據(jù),另一部分_dt來(lái)自數(shù)據(jù)庫(kù)。通過(guò)兩個(gè)for循環(huán)運(yùn)行的數(shù)據(jù)大約如下:700(dtExcel)* 10,000(_dt)= 7,000,000個(gè)比較。這里的代碼:public async Task<DataTable> GetAdressesFromDB(DataTable dtExcel){ try { return await Task.Run(() => { CurrentProgress = 0; ProgressbarDBVisible = true; _dtFoundDuplicates.Clear(); _dt = new DataTable(); _dt = DBConn.GetAllAddresses(dtExcel); ProgressMaximum = dtExcel.Rows.Count; for (int i = 0; i < dtExcel.Rows.Count; i++) { CurrentProgress++; for (int y = 0; y < _dt.Rows.Count; y++) { // Criteria to check duplicates string compareAdressExcel = ""; string compareAdressDB = ""; // Get the setted filter criteria and create both excel and db compare strings string[] criteriaFields = ConfigurationManager.AppSettings["strFilter"].Split(','); foreach (String cField in criteriaFields)
3 回答

郎朗坤
TA貢獻(xiàn)1921條經(jīng)驗(yàn) 獲得超9個(gè)贊
如果這是sql server,則應(yīng)該使用ssis。
它具有模糊匹配,這對(duì)于匹配來(lái)自兩個(gè)不同來(lái)源的地址上的記錄幾乎是必須的。
我也將使用ssis將數(shù)據(jù)導(dǎo)入到表中,并對(duì)管道中的數(shù)據(jù)進(jìn)行任何預(yù)處理。
然后可以使用作業(yè)來(lái)運(yùn)行整個(gè)過(guò)程。
- 3 回答
- 0 關(guān)注
- 168 瀏覽
添加回答
舉報(bào)
0/150
提交
取消