Public Class Login
Dim cn As OleDbConnection
Dim cmd As OleDbCommand
Dim dr As OleDbDataReader
Dim str As String
Dim i As Integer
Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK.Click
Try
cn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\varsha2011\plotdetails\plotdetails\login.mdb;")
'provider to be used when working with access database
cn.Open()
cmd = New OleDbCommand("select username, userpassword from login", cn)
dr = cmd.ExecuteReader
While dr.Read()
txtuser.Text = dr(0)
txtpass.Text = dr(1)
Me.Hide()
Dim mdi As New MDIParent1
mdi.Show()
MessageBox.Show("Wel-come " & txtuser.Text, "Wel-Come", MessageBoxButtons.OK)
End While
Catch
End Try
dr.Close()
cn.Close()
End Sub
Private Sub Cancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel.Click
If MessageBox.Show("Are You sure?", "Exiting", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = Windows.Forms.DialogResult.Yes Then
End
Else
Me.Show()
End If
End Sub
Private Sub Login_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
End Class
Dim cn As OleDbConnection
Dim cmd As OleDbCommand
Dim dr As OleDbDataReader
Dim str As String
Dim i As Integer
Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK.Click
Try
cn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\varsha2011\plotdetails\plotdetails\login.mdb;")
'provider to be used when working with access database
cn.Open()
cmd = New OleDbCommand("select username, userpassword from login", cn)
dr = cmd.ExecuteReader
While dr.Read()
txtuser.Text = dr(0)
txtpass.Text = dr(1)
Me.Hide()
Dim mdi As New MDIParent1
mdi.Show()
MessageBox.Show("Wel-come " & txtuser.Text, "Wel-Come", MessageBoxButtons.OK)
End While
Catch
End Try
dr.Close()
cn.Close()
End Sub
Private Sub Cancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel.Click
If MessageBox.Show("Are You sure?", "Exiting", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = Windows.Forms.DialogResult.Yes Then
End
Else
Me.Show()
End If
End Sub
Private Sub Login_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
End Class