Pls. tell me what's wrong with this code, I really need a big help.....
tnx in advance...
Imports System.Data.OleDb
Module Module1
Public admin As Boolean 'Use to identify if current user is Administrator
End Module
Public Class LoginForm1
Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK.Click
Dim cn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source= C:\Documents and Settings\Administrator\Desktop\login\login\salesReportDataSet.xsd")
Dim cmd As OleDbCommand = New OleDbCommand("SELECT Username FROM salesReportDataSet WHERE Login = '" & Username.Text & "' AND Password = '" & Password.Text & "' ", cn)
cn.Open()
Dim dr As OleDbDataReader = cmd.ExecuteReader()
If (dr.Read() = True) Then
Form1.Show()
MsgBox("Login Successful, " & Username.Text & "!")
Else
MsgBox("Invalid login")
End If
'Else
cn.Close()
End Sub
Private Sub Cancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel.Click
Me.Close()
End Sub
Private Sub LoginForm1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
End Class