I didnt Test this code, Because today I dont have VS on my mechine, Please try to get the idea first. And then write your own code is better.
main()
{
Thread t1 = new Thread(new ThreadStart(ThreadProc1));
Thread t2 = new Thread(new ThreadStart(ThreadProc2));
Thread t3 = new Thread(new ThreadStart(ThreadProc3));
t1.Start();
t2.Start();
t3.Start();
}
void ThreadProc1()
{
using (SqlConnection connection = new SqlConnection(
yourConnectionString))
{
SqlCommand command = new SqlCommand("sp_simple", connection);
command.Connection.Open();
command.Connection.Open.CommandType = CommandType.StoredProcedure;
SqlParameter par1= new SqlParameter("@CMONTHID", SqlDbType.NVarChar);
SqlParameter par2 = new SqlParameter("@CYEAR", SqlDbType.NVarChar);
command.Parameters.Add(par1,txt_Period.Text);
command.Parameters.Add(par2,txt_Year.Text);
command.ExecuteNonQuery();
}
}
void ThreadProc2()
{
using (SqlConnection connection = new SqlConnection(
yourConnectionString))
{
SqlCommand command = new SqlCommand("sp_Convent", connection);
}
}
void ThreadProc3()
{
using (SqlConnection connection = new SqlConnection(
yourConnectionString))
{
SqlCommand command = new SqlCommand("sp_None", connection);
}
}