Below is my code for login page I would like to show login user detail on home.
For login my code works properly but does not show currently login user show following error "NO data exists for column/row".
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Login.Click
RetrieveUserPass()
End Sub
' User id and password checking function
Public Sub RetrieveUserPass()
Try
Dim dbConn As OleDbConnection
Dim dbCommand As New OleDbCommand
Dim conn As New OleDbConnection
dbConn = New OleDbConnection(cnSettings())
dbCommand.CommandText = "SELECT * FROM [table1] Where User_id = '" & user_id.Text & "' And [password] = '" & password.Text & "'"
dbCommand.Connection = dbConn
dbConn.Open()
Dim dbDR As OleDb.OleDbDataReader = dbCommand.ExecuteReader
'Condition fail
If Not dbDR.HasRows Then
Login_fail.Show()
Login_fail.user_id.Clear()
Login_fail.Password.Clear()
Login_fail.user_id.Focus()
Me.Hide()
Else
'Condiion true
Home.Show()
Me.Hide()
Home.Label2.Text = dbDR("user_no")
End If
dbConn.Close()
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Critical, "Error")
End Try
End Sub