hi, i debug it keeps show: Syntax error in FROM clause.
i google and read many website tried remove ' ' from sql line still cannot.
can anyone help pls
Public Class frmLogin
Dim mypath = Application.StartupPath & "\password.mdb"
Dim Password = ""
Dim conn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\Users\Du\Documents\password.mdb")
Dim cmd As OleDbCommand
Dim dr As OleDbDataReader
Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim sql = "SELECT Username,Password FROM Password WHERE Username = '" & txtUserName.Text & "' AND Password = '" & txtPassword.Text & "'"
Try
conn.Open()
cmd = New OleDbCommand(sql, conn)
Dim dr As OleDbDataReader = cmd.ExecuteReader
Catch ex As InvalidOperationException
MsgBox(ex.Message)
End Try
Try
If dr.Read = False Then
MessageBox.Show("Authentication Failed...")
Else
MessageBox.Show("Login Successful...")
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
If conn.State <> ConnectionState.Closed Then
conn.Close()