Results 1 to 3 of 3

Thread: code for login

  1. #1
    Join Date
    Apr 2012
    Posts
    1

    Unanswered: code for login

    hi friends... am doing a mini project "Employment Precedence Status". I have almost completed it, but there are a few problems in it... since i am new to vb, i dono to correct it... hope u guys can help me if u can.

    i am using vb6.0 as front end
    ms access as back end.

    in this project, two of them can make use of it.
    The job seekers and the Recruiters... so i have provided a login procedure for both of them.
    i created separate db for both and registered their details into it. the problem is, when they login,it should be directed to their profile page... like i have created a form where their details are displayed. but it is displaying the details of only the first person who has registered... i am able to login but profile details automatically change to the first record in the table...


    here is my code for login and displaying details...
    LOGIN (FORM3)

    Dim pwd As String
    Dim msg As String


    Adodc1.Refresh

    uname = txtLoginID.Text
    pwd = txtpassword.Text
    Do Until Adodc1.Recordset.EOF
    If Adodc1.Recordset.Fields("email").Value = uname And Adodc1.Recordset.Fields("password").Value = pwd Then
    MsgBox ("Login Successfull! Goto Profile Page?")
    Form3.Hide
    Form8.Show
    Exit Sub
    Else
    Adodc1.Recordset.MoveNext
    End If
    Loop
    msg = MsgBox("Incorrect LoginID or Password,try again!")
    txtLoginID.Text = ""
    txtpassword.Text = ""

    End Sub

    PROFILE PAGE(FORM8)
    here i have set few labels to display the details from the db...


    If Form3.txtLoginID.Text = Adodc1.Recordset.Fields("email") Then
    lblid.Caption = Adodc1.Recordset.Fields("ID")
    lblName.Caption = Adodc1.Recordset.Fields("name")
    lblAge.Caption = Adodc1.Recordset.Fields("age")
    lblDOB.Caption = Adodc1.Recordset.Fields("dob")
    lblWorked.Caption = Adodc1.Recordset.Fields("worked")
    lblDesignation.Caption = Adodc1.Recordset.Fields("designation")
    lblMobile.Caption = Adodc1.Recordset.Fields("mobile")
    Else
    Adodc1.Recordset.MoveNext
    End If

    this code is not displaying the corresponding users details, instead it shows the first record from the databse...

    please tell me wat can i do... its urgent ,kindly respond me as early as possible

  2. #2
    Join Date
    Apr 2012
    Posts
    28
    PROFILE PAGE(FORM8)
    here i have set few labels to display the details from the db...
    Do Until Adodc1.Recordset.EOF
    If Form3.txtLoginID.Text = Adodc1.Recordset.Fields("email") Then
    lblid.Caption = Adodc1.Recordset.Fields("ID")
    lblName.Caption = Adodc1.Recordset.Fields("name")
    lblAge.Caption = Adodc1.Recordset.Fields("age")
    lblDOB.Caption = Adodc1.Recordset.Fields("dob")
    lblWorked.Caption = Adodc1.Recordset.Fields("worked")
    lblDesignation.Caption = Adodc1.Recordset.Fields("designation")
    lblMobile.Caption = Adodc1.Recordset.Fields("mobile")
    Else
    Adodc1.Recordset.MoveNext
    End If
    Loop

  3. #3
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    I would amend the Adodc1 object to not select ALL records but instead be filtered by email address so that only the one corresponding record is being retrieved. Safe to assume you have a unique index on email address too to avoid duplicates, right?
    George
    Home | Blog

Posting Permissions

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