h_korany

h_korany

  • NA
  • 1
  • 0

A sending mail code is not running

Nov 3 2004 7:12 AM
private void btnsendpassword_Click(object sender, System.EventArgs e) { SqlConnection con; con=new SqlConnection("user id=sa;password=sa;initial catalog=DotNet;data source=."); con.Open(); SqlCommand com; com=new SqlCommand(String.Format("execute forgetpassword'{0}'",txte_mail.Text),con); //string st1=com.ExecuteReader( "select PassWord from DCustomers where email ="+txte_mail.Text); //SqlCommand com; //com=new SqlCommand(); //com.Connection=con; com.CommandType=System.Data.CommandType.StoredProcedure; SqlParameter p1; p1=new SqlParameter("@email",System.Data.SqlDbType.NVarChar); SqlParameter p2; p2=new SqlParameter("@yourpassword",System.Data.SqlDbType.NVarChar); p2.Direction=ParameterDirection.Output; com.Parameters.Add(p1); com.Parameters.Add(p2); com.CommandText="forgetpassword"; p1.Value=(Convert.ToString(txte_mail.Text)); p2.Value="0"; string st3 = p2.Value.ToString(); try { MailMessage mailmesg=new MailMessage(); mailmesg.To=(txte_mail.Text); mailmesg.Subject="Your PassWord"; mailmesg.Body=( st3 ); SmtpMail.Send(mailmesg); SmtpMail.SmtpServer="mika1"; con.Close(); } catch(Exception e1) { lblmessage.Text=(e1.ToString()); }

Answers (1)