0

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"

    Try
        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
        conn.Open()

        Dim Result As Integer = sqlCom.ExecuteScalar
        sqlCom.Dispose()
        conn.Close()

        If Result > 0 Then


            MessageBox.Show("Present")

        Else
            MessageBox.Show("Wrong Input")
        End If

    Catch ex As Exception
    End Try

    Catch ex As Exception
    End Try

Edited by Xiao_1

2
Contributors
2
Replies
11
Views
2 Years
Discussion Span
Last Post by Xiao_1
0

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.

Edited by Xiao_1

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.