hello there!!
what i am trying to do is have a login screen that asks the user for a username and password, it will then check to see if the username and password are in the system and if they are it will let them in.
the database i am trying to connect to has 3 fields (Id,Username,Password)
Id is listed as the primary key and is set to auto number.
I dont really know much about vb.net however here is the code i have come up with so far
CODE
Imports System
Imports System.Data
Imports System.Data.OleDb
Public Class LoginForm1
Private Sub Cancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel.Click
Me.Close()
End Sub
Private Sub cmdEnter_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdEnter.Click
Dim strDSN As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Users\In The Know\Documents\Database1.mdb"
Dim strSQL As String = "SELECT * FROM Developer"
Dim myConn As New OleDbConnection(strDSN)
Dim myCmd As New OleDbCommand(strSQL, myConn)
Dim Usrdata As OleDbDataReader = Nothing
myConn.Open()
Usrdata = myCmd.ExecuteReader()
Dim strName As String
Dim strPass As String
Dim pesan As String 'pesan is Indonesian and it is the same with Message in english'
strName = txtUsr.Text
strPass = txtPwd.Text
Do Until Usrdata.Recordset.EOF
If Usrdata.Recordset.Fields("username").Value = strName And Usrdata.Recordset.Fields("password").Value = strPass Then
Me.Hide()
Form2.Show() 'if the login succeed then form that contain employee info shown
Exit Sub
Else
Usrdata.Recordset.MoveNext()
End If
Loop
End Sub
End Class
any help would be much appreciated