I am developing an application in which there are are multiple users. for showing every detail of perticular user index is needed. And how to show this detail.

Hey vasim,
Can you explain what you want? Which kind of application it is? And where ur saving the iindex? What is this index is all about?

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

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

Edited 3 Years Ago by happygeek: fixed formatting

This article has been dead for over six months. Start a new discussion instead.