Results 1 to 2 of 2

Thread: what wud be the code for password change option

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2005
    Posts
    4

    what wud be the code for password change option

    dear guys

    now i can log in by user name and user password by usuing login table (username & userpassword)

    what if a user want to change his password then what wud be the code for that ..

    pls give me some hints

    ur help wud be appriciated for a bigginer like me

    regards
    imti

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: what wud be the code for password change option

    It is simply a matter of updating a record in a table like any other.
    VB Code:
    1. Dim myCommand As New SqlCommand("UPDATE Users SET userpassword = @newpassword WHERE username = @username", myConnection)
    2.  
    3. myCommand.Parameters.Add("@newpassword", newPasswordString)
    4. myCommand.Parameters.Add("@username", currentUserNameString)
    5.  
    6. myConnection.Open()
    7. myCommand.ExecuteNonQuery()
    8. myConnection.Close()
    Note that you would put the appropriate values where I have used "newPasswordString" and "currentUserNameString".
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width