S
Suhail Salman
Dear All,
i got the following error message in an applications that opens 13
threads and all of them calling a stored procedure which retreieves data
from SQLServer and fills them to a table the error appears at the following
statment
sqlda.Fill(dtMessages);
During an infinit loopp
------
while(true)
{
#region While Body
ReConnect:
// check connectbion status and retry to connect in case of open failure
sqlcmd.Parameters["@cusDate"].Value=DateTime.Now;
sqlcmd.Parameters["@cusTime"].Value=DateTime.Now.ToString("HH:mm");
SqlDataAdapter sqlda;
DataTable dtMessages=new DataTable();
RECHECK:
try
{
sqlda=new SqlDataAdapter(sqlcmd); // have to put it here although of the
perfomance leak
Application.DoEvents();
sqlda.Fill(dtMessages);
Application.DoEvents();
lblSQLConnectionStatus.ForeColor=System.Drawing.Color.SteelBlue;
lblSQLConnectionStatus.Text="OnLine";
}
catch(Exception ex)
{
ApplicationSettingsCLL.ApplicationSettings.logEvent(System.Diagnostics.Event
LogEntryType.Error,"Communication error with SQL
Server\nError:"+ex.Message+"\nStack Trace:"+ex.StackTrace);
lblSQLConnectionStatus.ForeColor=System.Drawing.Color.Tomato;
lblSQLConnectionStatus.Text="OFFLINE!!";
Thread.Sleep(2000);
goto RECHECK;
}
. . . .
}
------------
the error message is
Thread was being aborted.
stack trace :
Stack Trace:
at System.Threading.WaitHandle.WaitMultiple(WaitHandle[] waitHandles, Int32
millisecondsTimeout, Boolean exitContext, Boolean WaitAll)
at System.Threading.WaitHandle.WaitAny(WaitHandle[] waitHandles, Int32
millisecondsTimeout, Boolean exitContext)
at System.Data.SqlClient.ConnectionPool.GetConnection(Boolean&
isInTransaction)
at
System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnec
tionString options, Boolean& isInTransaction)
at System.Data.SqlClient.SqlConnection.Open()
at System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection connection,
ConnectionState& originalState)
at System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32
startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable, IDbCommand
command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)
i got the following error message in an applications that opens 13
threads and all of them calling a stored procedure which retreieves data
from SQLServer and fills them to a table the error appears at the following
statment
sqlda.Fill(dtMessages);
During an infinit loopp
------
while(true)
{
#region While Body
ReConnect:
// check connectbion status and retry to connect in case of open failure
sqlcmd.Parameters["@cusDate"].Value=DateTime.Now;
sqlcmd.Parameters["@cusTime"].Value=DateTime.Now.ToString("HH:mm");
SqlDataAdapter sqlda;
DataTable dtMessages=new DataTable();
RECHECK:
try
{
sqlda=new SqlDataAdapter(sqlcmd); // have to put it here although of the
perfomance leak
Application.DoEvents();
sqlda.Fill(dtMessages);
Application.DoEvents();
lblSQLConnectionStatus.ForeColor=System.Drawing.Color.SteelBlue;
lblSQLConnectionStatus.Text="OnLine";
}
catch(Exception ex)
{
ApplicationSettingsCLL.ApplicationSettings.logEvent(System.Diagnostics.Event
LogEntryType.Error,"Communication error with SQL
Server\nError:"+ex.Message+"\nStack Trace:"+ex.StackTrace);
lblSQLConnectionStatus.ForeColor=System.Drawing.Color.Tomato;
lblSQLConnectionStatus.Text="OFFLINE!!";
Thread.Sleep(2000);
goto RECHECK;
}
. . . .
}
------------
the error message is
Thread was being aborted.
stack trace :
Stack Trace:
at System.Threading.WaitHandle.WaitMultiple(WaitHandle[] waitHandles, Int32
millisecondsTimeout, Boolean exitContext, Boolean WaitAll)
at System.Threading.WaitHandle.WaitAny(WaitHandle[] waitHandles, Int32
millisecondsTimeout, Boolean exitContext)
at System.Data.SqlClient.ConnectionPool.GetConnection(Boolean&
isInTransaction)
at
System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnec
tionString options, Boolean& isInTransaction)
at System.Data.SqlClient.SqlConnection.Open()
at System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection connection,
ConnectionState& originalState)
at System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32
startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable, IDbCommand
command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)