I'm executing SQL Queries and saving the results in Excel using NUnit Framework and C#
I'm using ThreadPool which calls writeToFile function which opens the excel workbook, excel worksheet and writes all the data from DataAdapter to excel cell by cell.
My code is as below
foreach (string[] SQLQueries in SQLQueriesList)
{
if (SQLQueries[1].ToLower().Equals("yes"))
{
ThreadPool.QueueUserWorkItem(new WaitCallback(writeToFile),
string.Concat(sqlQuery, ':', string.Concat(scid, "_", SQLQueries[2]), ':', SQLQueries[2]))
}
}
The exception that I'm getting is:
The message filter indicated that the application is busy. (Exception from HRESULT: 0x8001010A (RPC_E_SERVERCALL_RETRYLATER))
System.Runtime.InteropServices.COMException (0x8001010A): The message filter indicated that the application is busy. (Exception from HRESULT: 0x8001010A (RPC_E_SERVERCALL_RETRYLATER))
at System.Runtime.InteropServices.ComTypes.ITypeInfo.GetTypeAttr(IntPtr& ppTypeAttr)
at System.Dynamic.ComRuntimeHelpers.GetTypeAttrForTypeInfo(ITypeInfo typeInfo)
at System.Dynamic.IDispatchComObject.EnsureScanDefinedMethods()
at CallSite.Target(Closure , CallSite , ComObject )
at CallSite.Target(Closure , CallSite , Object )
Could someone please help me to resolve this issue
User contributions licensed under CC BY-SA 3.0