Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21363

forgot your password form in vb6 retrieve password from database

$
0
0
hello guys
i am in the 10th grade and i am creating a project for my computers class in which i have created a login and register facility
the forgot your password code doesnt work . the password is to be retrieved from a database dat.mdb
the user will be asked for an answer to a security question which has to be retrieved from database and also their username
if the answer and the username match then a new from is showed that displays the password
here is my code so far

Option Explicit
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim sql As String
Dim pname As Boolean
Dim hi As String
Dim hello As String
Dim bye As String
Private Sub Form_Load()
Set cn = New ADODB.Connection
Set rs = New ADODB.Recordset
cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Users\nihar\Documents\CourseworkFiles\Development and Testing\Files\dat.mdb;Persist Security Info=False"
cn.Open
sql = "select * from UserData"
rs.CursorLocation = adUseClient
rs.Open sql, cn, adOpenDynamic, adLockOptimistic
pname = False
End Sub
Private Sub GetPass1_Click()
While Not rs.EOF
If rs!day = hi And rs!month1 = hello And rs!Year2 = bye And rs!Answer = Ans.Text Then
'our if statement checks that all things are correct
pname = True
word = rs!Password
End If
rs.MoveNext
Wend
If pname = False Then
MsgBox "There Is An Error In Showing Password.Please Check Answer And Date Of Birth ", vbOKCancel
Else
ForPass.Hide
GetPass.Show
End If
End Sub



i use vb 6 and ms access
pls help

Viewing all articles
Browse latest Browse all 21363

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>