C# .NET - How to check number of opened threads?
Asked By Vishwa I on 09-Oct-13 06:16 AM
I need to open 200 connections to a sql database and I am using the following code.
public void OpenMultipleConnections()
{
for (int c = 1; c <= 200; c++)
{
System.Threading.Timer Timer1 = new System.Threading.Timer(TimerCallback, null, 0, 0);
//System.Threading.Timer Timer1 = new System.Threading.Timer(TimerCallback);
}
}
private void TimerCallback(object state)
{
DbConnection conn = null;
CTransactionDBServer.consoleWrite("******** Conection No. : " + ConCount.ToString() + " opened ***********");
ConCount++;
conn = dbobj.getConnection();
}
How can I check 200 threads assigned with Db connectivity are created or not?
Please give the solution, it is required urgently.