Hello Everyone,,please help me out here.i have a problem whicn needs to be solved..
i'm creating a windows form using C# visual studio 2005 and my database is SQL Server 2005..i have a Login table inside my database.
the login windows works fine.however i need a form which will let the user change the password if needed. the username and the password must be checked in the database before being able to change....and the new password and the verifyed password should also be checked if its matching or not....if yes the password should be updated in the database....

please help me out here guys..

i really need your help guyz.
thanks in advance..

Recommended Answers

All 3 Replies

please help me out here guys..

I see a list of what you want to do, but no actual question. Have you tried creating the "change password" form yet? Is there anything specific that's bothering you?

For the 1st part (checking username and password match) you can do the same as for login check (you can even use that code).
For last one, to check if two passowrds are equal (in textboxes) simply do:

if(textBoxPswd1.Text == textBoxPswd2.Text)
   //passwords both equal, so continue
    //passwords do not match

For the insert new passord you have to use an sql UPDATE query like:

SqlConnection conn = new SqlConnection("connString");
string query = @"UPDATE Users SET Password = @pass WHERE Username = @user";
SqlCommand cmd = new SqlCommnand(query, conn);
cmd.Parameters.Add("@pass", SqlDbType.VarChar, 50).Value = textBoxPswd1.Text;
cmd.Parameters.Add("@user", SqlDbType.VarChar, 50).Value = textBoxUsername.Text;

NOTE: change table name and fields appropreately. I only used example names.
Hope it helps,

thanks a lot.for your help...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.