how i put it like i am a student so i choose student and key in username n password, if choose worng like i click lectuere but i not, so cant is worng cant login

Private Sub cbinfo_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbinfo.SelectedIndexChanged

    Dim conn As New System.Data.OleDb.OleDbConnection()
    conn.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\temp\Database1.accdb"

        Dim sqlcmd As String = "SELECT Count(*) FROM tbl_datain WHERE Personl ='" & cbinfo.Items(cbinfo.SelectedIndex) & "' " & _
         "And UserID ='" & txtname.Text & "' And PassWord ='" & txtpass.Text & "'"
        Dim sqlCom As New System.Data.OleDb.OleDbCommand(sqlcmd)
        sqlCom.Connection = conn

        Dim Result As Integer = sqlCom.ExecuteScalar

        If Result > 0 Then


            MessageBox.Show("Wrong Input")
        End If

    Catch ex As Exception
    End Try

    Catch ex As Exception
    End Try

Recommended Answers

Just from a quick glance see if this helps: cbinfo.Items(cbinfo.SelectedIndex).ToString().

Jump to Post

All 2 Replies

thank. but if worng input should not come another form of the student info how to do that only when corrct then come out the other form.

Be a part of the DaniWeb community

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