// insertion function return true if insertion done
public bool insertion()
{
bool result=false;
try
{
object[,] obj = new object[,] { { "@Name", txtName.Text }, { "@Address", txtAddress.Text }, { "@EmailId", txtEmailId.Text } };
result=DB.ExecuteNonQuery_SP("InsertThreading", obj);
}
catch (Exception ex) { }
return result;
}
//thread for insertion and display "success" if InsertionThreadMethod() is true
protected void btnSave_Click(object sender, EventArgs e)
{
ThreadStart InsertionThread = new ThreadStart(insertion);
Thread t1 = new Thread(InsertionThread);
t1.Priority = ThreadPriority.Highest;
t1.Start();
if (InsertionThreadMethod() == true)
{
lblResult.Text = "Insertion Successful";
}
}