Hi all. I am trying to setup a Login Script in VB.net. I have been trying to use the below code: Private Sub btnLogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLogin.Click Dim mypath = Application.StartupPath & "\security.mdb" Dim Password = "" Dim conn As New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\Phoenix\Develop\mailorder\mailorder\security.mdb") Dim cmd As OleDb.OleDbCommand Dim sql = "SELECT Username,Password FROM Password WHERE Username = '" & txtUsername.Text & "' AND Password = '" & txtPassword.Text & "'" cmd = New OleDb.OleDbCommand(sql, conn) conn.Open() Dim dr As OleDb.OleDbDataReader = cmd.ExecuteReader Try conn.Open() 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() End If Dim form As New frmSwitchboard form.Show() End Sub When running i get the error message: OleDbException was unhandled Syntax Error in FROM Clause I am very new to this and any help that you can give me will be greatley appreciated. Thanks in Advance ImF

11 Years
Discussion Span
Last Post by Proteus

Try to write the sql question without the single quotes around the username and password in WHERE clause.

For more please use the CODE tag....

Edited by happygeek: fixed formatting

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.