protected void btnSave_Click(object sender, EventArgs e)
{
ThreadStart InsertionThread = new ThreadStart(insertion);
Thread t1 = new Thread(InsertionThread);
t1.Priority = ThreadPriority.Highest;
t1.Start();
ThreadStart MailThread = new ThreadStart(Mail);
Thread t3 = new Thread(MailThread);
t3.Start();
display();
}
public void Mail()
{
MailMessage mail = new MailMessage();
mail.From = new MailAddress("mhdaktar1@gmail.com");
mail.To.Add(txtEmailId.Text);
mail.IsBodyHtml = true;
mail.Subject = "test";
mail.Body = "welcome";
SmtpClient smtp = new SmtpClient("smtp.gmail.com",587);
smtp.Credentials = new System.Net.NetworkCredential("mhdaktar1@gmail.com", "9995100143");
smtp.EnableSsl = true;
smtp.Send(mail);
}
<pre lang="cs">public void insertion()
{
try
{
object[,] obj = new object[,] { { "@Name", txtName.Text }, { "@Address", txtAddress.Text }, { "@EmailId", txtEmailId.Text } };
DB.ExecuteNonQuery_SP("InsertThreading", obj);
}
catch (Exception ex) { }
}</pre>