Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6049231
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:33:09+00:00 2026-05-23T07:33:09+00:00

if you could please help me out… i am try to create o forgot

  • 0

if you could please help me out… i am try to create o forgot password method.access my database and send an e-mail. if you please help me out since i don’t have a lot of experience. thanking you in advance. Login is unique. C#

protected void LinkButton1_Click(object sender, EventArgs e)
{

        var sqlCon = new SqlConnection(System.Configuration.ConfigurationManager.
            ConnectionStrings["ConnectionString"].ConnectionString);

        SqlCommand cmd = new SqlCommand();
        cmd.Connection = sqlCon;
        cmd.CommandText = "select Password from Person where Login= @Login ";
        cmd.Connection.Open();
        string Password = cmd.ExecuteScalar().ToString();
        cmd.Connection.Close();
        cmd.Dispose();

        SqlCommand cmd1 = new SqlCommand();
        cmd1.Connection = sqlCon;
        cmd1.CommandText = "select e_mail from Person where Login= @Login "; 
        cmd1.Connection.Open();
        string e_mail = cmd.ExecuteScalar().ToString();
        cmd.Connection.Close();
        cmd.Dispose();

        if (Login.Text.Equals("@Login"))
        {

           Class1 S = new Class1();
           S.sendMail(e_mail, "Your Password request", Password);
           Response.Write("<script>");
        }

}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T07:33:09+00:00Added an answer on May 23, 2026 at 7:33 am

    first you can make one call to sql instead of two,
    try somthing like this (not tested!)

    var sqlCon = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
    SqlCommand cmd = new SqlCommand("select e_mail, Password from Person where Login= @Login ", sqlCon);            
    cmd.Connection.Open();            
    
    cmd.Parameters.Add(new SqlParameter("@Login", Email.Text));
    
    string email = "", password = "";
    
    using (SqlDataReader sdr = cmd.ExecuteReader())
    {
        while (sdr.Read())
        {
            email = sdr.GetString(0);
            password = sdr.GetString(1);
        }
    }
    cmd.Connection.Close();
    cmd.Dispose();
    
    
    
    SmtpClient mailClient = new SmtpClient("your smtp");
    MailMessage mailMessage = new MailMessage();
    mailMessage.From = new MailAddress("YOU");
    mailMessage.To.Add(email);
    
    mailMessage.Subject = "password recovery";
    mailMessage.Body = "hello " + email + " your password : " + password;
    mailMessage.IsBodyHtml = true;
    
    mailClient.Send(mailMessage);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Ok so could anyone please help me out with the VB for auto entering
yes, this is a homework-type question but could you please help me out? In
I'm probably doing something wrong, being a newbie. Could you please help me out?
Could someone please help me out with this. I need to find the gml:pos
Could please anybody help me to sort it out? It can be done like
Please help! I couldn't figure it out how to map the following situation: I
Hi Guys could you please help me refactor this so that it is sensibly
I've recently written this with help from SO. Now could someone please tell me
Good day, could you please help me look and this code and tell me
This might be a piece of cake for java experts. Please help me out:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.