Forum guidelines
AuthorQuestion
need code for password chnge
Posted on: 21 Aug 2013
how to change password in c# with ms access database..
please provide me full c# code....

AuthorReply
Re: need code for password chnge
Posted on: 21 Aug 2013  
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.OleDb;
namespace Forgot_password
{
    public partial class Form1 : Form
    {
        string ConnectionString = System.Configuration.ConfigurationSettings.AppSettings["dsn"];
        OleDbCommand com;
        string str;
        byte up = 0;
        //OleDbDataAdapter oledbda;

        public Form1()
        {
            InitializeComponent();
        }

        private void btn_change_Click(object sender, EventArgs e)
        {
            OleDbConnection con = new OleDbConnection(ConnectionString);
          

            if (textBox3.Text != textBox2.Text)
            {
                MessageBox.Show("confirm password not matching with new passsword");
                textBox3.Focus();
                return;
            }

            try
            {
               
                con = new OleDbConnection(ConnectionString);
                con.Open();
                str = "select * from login";
                com = new OleDbCommand(str, con);
                OleDbDataReader reader = com.ExecuteReader();


                while (reader.Read())
                {
                    if (textBox1.Text == reader["empid"].ToString())
                    {
                        up = 1;
                    }
                }

                if (up == 1)
                {
                    str = "update login set newpwd='" + textBox3.Text + "' where empid='" + textBox1.Text + "'";
                    com = new OleDbCommand(str, con);
                    com.ExecuteNonQuery();
                    MessageBox.Show("Password changed");
                }
                else
                {
                    MessageBox.Show("Please enter correct empid and Newpassword");
                    textBox1.Focus();
                }
                reader.Close();
                con.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
    }
}


If this post helps you mark it as answer
Thanks

Re: need code for password chnge
Posted on: 22 Aug 2013  
ths code is not working.... ths is for windows form apllication i m working on web application.. pls send me "change password c# code" for web application..thnks
Re: need code for password chnge
Posted on: 22 Aug 2013  
www.c-sharpcorner.com/uploadfile/satyapriyanayak/change-a-password-in-asp-net/
If this post helps you mark it as answer
Thanks

Re: need code for password chnge
Posted on: 23 Aug 2013  
on ths link the c# code for sql server database... bt i need code for ms access database..help me
thnks

SPONSORED BY

Custom Software Development
MCN is your source for developing solutions involving websites, mobile apps, cloud-computing, databases, BI, back-end services and processes and client-server applications.