2 Replies - 1033 Views - Last Post: 23 August 2012 - 12:18 AM Rate Topic: -----

#1 sigrid012  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 22-August 12

how to check if the username and the password are match using vb.net

Posted 22 August 2012 - 07:38 PM

hi.. does everyone know here how can i check if the username and the password of the user is match using vb.net and excel as my database... well . i dont i have any codes .. thanks :)
Is This A Good Question/Topic? 0
  • +

Replies To: how to check if the username and the password are match using vb.net

#2 miguel879  Icon User is offline

  • New D.I.C Head

Reputation: 10
  • View blog
  • Posts: 40
  • Joined: 20-July 12

Re: how to check if the username and the password are match using vb.net

Posted 22 August 2012 - 08:38 PM

use for loop and if else so that you can verify and match username and password in your db..
Was This Post Helpful? 0
  • +
  • -

#3 sigrid012  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 22-August 12

Re: how to check if the username and the password are match using vb.net

Posted 23 August 2012 - 12:18 AM

i used this code
 Dim con As New OleDbConnection("provider=Microsoft.Jet.OLEDB.4.0;Data Source='C:\Users\sigrid\Documents\5s\5sdata.xls';Extended Properties=Excel 8.0;")
        Dim cmd As OleDbCommand = New OleDbCommand( _
                 "SELECT * FROM Users WHERE Username = '" & _
                 txtUsername.Text & "' AND [Password] = '" & txtPassword.Text & "' ", con)
        con.Open()
        Dim sdr As OleDbDataReader = cmd.ExecuteReader()
        ' If the record can be queried, it means passing verification, then open another form.   
        If (sdr.Read() = True) Then
            MessageBox.Show("The user is valid!")
            Dim ValidatorMain As New ValidatorMain
            ValidatorMain.Show()
            Me.Hide()
        Else
            MessageBox.Show("Invalid username or password!")
        End If


is this the same? to check if the username and password of the user is correct ... teach how to do this thanks :)

This post has been edited by AdamSpeight2008: 23 August 2012 - 09:21 AM
Reason for edit:: Please use the CODE TAG

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1