Welcome to Dream.In.Code
Getting VB Help is Easy!

Join 118,691 VB Programmers for FREE! Ask your question and get quick answers from experts. There are 1,157 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! Registration is fast and FREE... Join Now!



How to set a new password by user

 
Reply to this topicStart new topic

How to set a new password by user, Im beginner and didn't know how to solve it,please help me

SEAHSING
post 4 Aug, 2008 - 10:23 AM
Post #1


New D.I.C Head

*
Joined: 4 Aug, 2008
Posts: 4

If txtNewname.Text = Val(txtName.Text) And txtNewpassword.Text = Val(txtNewpassword.Text) & _
txtConfirmpassword.Text = Val(txtConfirmpassword.Text) Then
Else
MsgBox "Please types something inside these commands", vbCritical, "ERRoR"
End If
User is offlineProfile CardPM

Go to the top of the page


dineeshd
post 4 Aug, 2008 - 10:29 AM
Post #2


D.I.C Addict

Group Icon
Joined: 30 Jun, 2008
Posts: 543



Thanked 15 times

Dream Kudos: 575
My Contributions


What exactly you want? do you want to save the user name and password to database or just validation of them.
User is offlineProfile CardPM

Go to the top of the page

SEAHSING
post 4 Aug, 2008 - 10:39 AM
Post #3


New D.I.C Head

*
Joined: 4 Aug, 2008
Posts: 4

I want programme change password while user click the reset password button and change password
User is offlineProfile CardPM

Go to the top of the page

dineeshd
post 4 Aug, 2008 - 10:51 AM
Post #4


D.I.C Addict

Group Icon
Joined: 30 Jun, 2008
Posts: 543



Thanked 15 times

Dream Kudos: 575
My Contributions


In database right?
User is offlineProfile CardPM

Go to the top of the page

SEAHSING
post 4 Aug, 2008 - 10:59 AM
Post #5


New D.I.C Head

*
Joined: 4 Aug, 2008
Posts: 4

Yes
User is offlineProfile CardPM

Go to the top of the page

dineeshd
post 4 Aug, 2008 - 11:34 AM
Post #6


D.I.C Addict

Group Icon
Joined: 30 Jun, 2008
Posts: 543



Thanked 15 times

Dream Kudos: 575
My Contributions


Here, first you need to establish one connection with database, if you don't have one then refer to this CLICK HERE for creating a connection with database. Then change the code to something like this.

vb

If txtNewname.Text = Val(txtName.Text) And txtNewpassword.Text = Val(txtNewpassword.Text) & _
txtConfirmpassword.Text = Val(txtConfirmpassword.Text) Then
Else
strQuery = "UPDATE TABLE_NAME SET USER_NAME = " & txtNewname.Text & ", PASSWORD = " & txtNewpassword.Text & " WHERE USER_NAME = " & <PROVIDE CURRENT PASSWORD TEXT BOX STRING HERE>

With m_dbCmd
.CommandType = adCmdText
.CommandText = strQuery
.Execute
End With

End If


All objects I have used is based on the example database connection snippet, you need to replace with your's. And the SQL statement is for SQL Server, if you are not using SQL Server then you need to make the necessary changes.
User is offlineProfile CardPM

Go to the top of the page

SEAHSING
post 4 Aug, 2008 - 07:13 PM
Post #7


New D.I.C Head

*
Joined: 4 Aug, 2008
Posts: 4

Private Sub Save_Click()
Dim strQuery As String

If txtName.Text = "SEAH " And txtPassword.Text = "1234" Then
If txtNewname.Text = Val(txtName.Text) And txtNewpassword.Text = Val(txtNewpassword.Text) & _
txtConfirmpassword.Text = Val(txtConfirmpassword.Text) Then
Else
'strQuery = "UPDATE TABLE_NAME SET USER_NAME = " & txtNewname.Text & ", PASSWORD = " & txtNewpassword.Text & " WHERE USER_NAME = " & <PROVIDE CURRENT PASSWORD TEXT BOX STRING HERE>

With m_dbCmd 'what meaning of m_dbCmd
.CommandType = adCmdText
.CommandText = strQuery
.Execute
End With

End If
Else
MsgBox "Your original name and password incorrect", vbCritical, "TRY AGAIN"
txtName.Text = ""
txtPassword.Text = ""
txtNewname.Text = ""
txtNewpassword = ""
txtName.SetFocus
End If
End Sub
User is offlineProfile CardPM

Go to the top of the page

dineeshd
post 5 Aug, 2008 - 12:17 AM
Post #8


D.I.C Addict

Group Icon
Joined: 30 Jun, 2008
Posts: 543



Thanked 15 times

Dream Kudos: 575
My Contributions


This code will not work at all. You need to replace the table name, column name and other objects with the ones you have. And you have not established the database connection too. Go to the Sample code and get it done. You cannot expect people to do everything for you. Do your homework first and come back for any errors and doubts.

Best of luck.... icon_up.gif
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 10/12/08 08:01AM

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month