Home > Net >  From the database query data export Excel, then an error, the code can cycle for up to ten minutes
From the database query data export Excel, then an error, the code can cycle for up to ten minutes

Time:09-17

For this RuntimeCallableWrapper to COM context 0 xb1d120 failure, mistakes are as follows: system call fails, (exception from HRESULT: 0 x80010100 (RPC_E_SYS_CALL_FAILED)), is the usual cause to create this RuntimeCallableWrapper COM context 0 xb1d120 disconnected,



The code
//Values took data
List ListLeave=new List (a);
Int countItem=1;
Int itemIndex=0;
List ListCount=new List (a);
The foreach (List Item1 in dicLeave. Values)
{
for (int i=0; I & lt; Item1. Count; I++)
{
L=(Leave) item1 [I];
ListLeave. Add (l);
CountItem++;

}
ListCount. Add (countItem);
}

//ifj1==listCount one value, listCount replaced an int j1=0; J1 & lt; ListLeave. Count; J1 + +
Foreach (Leave Leave in listLeave)//listLeave count==1357
{
L=leave;
The month=the Convert. ToInt32 (l.D BeginDate. Substring (5, 2));
Day=the Convert. ToInt32 (l.D BeginDate. Substring (8, 2));
H=(Convert. ToDouble (l.N ActualLeaveHours))/Convert ToDouble (l.N ActualLeaveTime);
//determine annual leave
If (l.C LeaveType. Equals (" BS04 "))
{
//if you ask for leave more than 1 day
If (the Convert. ToDouble (l.n ActualLeaveTime) & gt; 1)
{
Double n=Math. Between (Convert ToDouble (l.n ActualLeaveTime));

For (int p=0; P & lt; n; P++)
{
MonthReset ();
IsSunday (isWeek);
IsHalfDay (p, n);
XSt. Cells [row04 col04]=month + + day "month", "day ~ + h +" "h".
Count04=2;
The reset ();
Count04=1;
}
Jia04=the Convert. ToDouble (l.N ActualLeaveTime);
Sum04 +=jia04;
}
The else
{
XSt. Cells [row04 col04]=month + + day "month" + "to" + l.N ActualLeaveHours + "H".
Jia04=the Convert. ToDouble (l.N ActualLeaveTime);
Sum04 +=jia04;
}

}
//determine home leave
# region
Else if (l.C LeaveType. Equals (" BS07 "))
{
Double n=Math. Between (Convert ToDouble (l.n ActualLeaveTime));
If (the Convert. ToDouble (l.n ActualLeaveTime) & gt; 1)
{
For (int p=0; P & lt; n; P++)
{
MonthReset ();

XSt. Cells [row07 col07]=month + + day "month", "day ~ + h +" "h".
Count07=1;
Count04=1;
The reset ();
}
Jia07=the Convert. ToDouble (l.N ActualLeaveTime);
Sum07 +=jia07;
}
The else
Ask for leave//a single
{
XSt. Cells [row07 col07]=month + + day "month" + "to" + l.N ActualLeaveHours + "H".
Jia07=the Convert. ToDouble (l.N ActualLeaveTime);
Sum07 +=jia07;
}

}

CodePudding user response:

What is the good way to solve???
  •  Tags:  
  • C#
  • Related