bharanidharanit
Well-known member
Hello,
I am doing Login Screen in VS2008.
When i logon with username and password in form it only checking the first field in database.
How to do coding for checking all the fields???
This is my coding
I am doing Login Screen in VS2008.
When i logon with username and password in form it only checking the first field in database.
How to do coding for checking all the fields???
This is my coding
VB.NET:
Imports System.Data.OleDb
Public Class frmLogin
Private connstring As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\db.mdb"
Private conn As OleDb.OleDbConnection
Private dr As OleDb.OleDbDataReader
Private Sub frmLogin_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
conn = New OleDbConnection(connstring)
conn.Open()
End Sub
Private Sub btnOk_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOk.Click
Dim cmd As New OleDbCommand("select * from login", conn)
dr = cmd.ExecuteReader
dr.Read()
If dr(0) = txtUser.Text And dr(1) = txtPwd.Text Then
Form2.Show()
Else
txtUser.Clear()
txtPwd.Clear()
txtUser.Focus()
End If
End Sub
End Class