0

ublic Class Login

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
    If Password.Text = "" Or Username.Text = "" Then
        MessageBox.Show("Password v likh..", "Banday da puttar ban.. :D ", MessageBoxButtons.OK, MessageBoxIcon.Error)
    Else
        Dim conn As New System.Data.OleDb.OleDbConnection()

        conn.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\CCIMS.mdb; Persist Security Info= False"
        Dim cmd As New OleDb.OleDbCommand
        Dim sql = "SELECT UserName, Password FROM Login WHERE UserName = '" & Username.Text & "' And Password= '" & Password.Text & "'"
        cmd = New OleDb.OleDbCommand(sql, conn)
        conn.Open()
        Dim dr As OleDb.OleDbDataReader = cmd.ExecuteReader
        Try
            If dr.Read = False Then
                MessageBox.Show("Access Denied..!!")
                Me.Show()
            Else
                MessageBox.Show("Access Granted..!!")
                Main.Show()

            End If
        Catch ex As Exception
            MsgBox(ex.Message)

        End Try





    End If



End Sub

Edited by deceptikon: Moved to VB.NET

2
Contributors
1
Reply
17
Views
3 Years
Discussion Span
Last Post by oussama_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.