How to find index in vb.net when connected with ms-access2007:)

Th'x in advance.

Recommended Answers

All 5 Replies

Which index you want to find? Explain in detail.

As Pgmer asked you, you will have to specify about what index is all about!?

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
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.