[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details

Excel File Comparision

Asked by Senz79 in C# Programming Language, .NET, .NET Framework 2.x

Hello All
I am trying to compare two excel files.The code below is doing the comparision,  but here i have a problem , both the excel files have more than 20000 rows and its taking hell lot of time and above all its taking system process too. Kindly provide me some way to optimize it.

Thanks
Senz
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
private void OpenTADDAM()
        {
            _Sbook = ClsComm.OpenExcelWorkbook(strTADDAMsrc);
            //ClsComm.excel.Visible = true;
            _Ssheet = (Excel.Worksheet)_Sbook.ActiveSheet;
            _Ssheet.Select(Type.Missing);
            sRngUsed = _Ssheet.UsedRange;
            
            _Dbook = ClsComm.OpenExcelWorkbook(strNETEISSsrc);
            //ClsComm.excel.Visible = true;
            _Dsheet = (Excel.Worksheet)_Dbook.ActiveSheet;
            _Dsheet.Select(Type.Missing);
            dRngUsed = _Dsheet.UsedRange;
 
 
 
 
            for (int i = 1; i <= sRngUsed.Rows.Count; i++)
            {
                for (int j = 1; j <= dRngUsed.Rows.Count; j++)
                {
                    sRngAdv = _Ssheet.get_Range("A" + i.ToString(), Type.Missing);
                    dRngAdv = _Dsheet.get_Range("F" + j.ToString(), Type.Missing);
 
                    if (dRngAdv.Value2 != null)
                    {
                        if (sRngAdv.Value2 != null)
                        {
                            if (dRngAdv.Value2 == sRngAdv.Value2)
                            {
                                MessageBox.Show("TADDAM : " + sRngAdv.Value2.ToString() + "  NETEISS : " + dRngAdv.Value2.ToString());
                            }
                            else
                            {
                               // MessageBox.Show("not matched : " + i.ToString() + " / " + j.ToString());
                            }
                        }
                    }
                }
            }
 
 
        }
[+][-]11/03/09 10:37 PM, ID: 25736947Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/03/09 11:16 PM, ID: 25737101Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/04/09 02:25 AM, ID: 25737913Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/04/09 02:31 AM, ID: 25737946Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/04/09 02:41 AM, ID: 25737995Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/05/09 12:55 PM, ID: 25753907Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/05/09 06:58 PM, ID: 25756287Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/05/09 07:18 PM, ID: 25756352Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091021-EE-VQP-81 - Hierarchy / EE_QW_3_20080625