Alex Lozano Alex Lozano - 1 year ago 124
SQL Question

Syntax error in FROM close?

Trying to work on this for a while now, I've gone back and fort on having my own log in page without using the tool of log in, but I prefer on using the Login just because I've used it before.
Anyways I'm getting the error when trying to log in

Syntax error in FROM clause

Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.

Exception Details: System.Data.OleDb.OleDbException: Syntax error in
FROM clause.

Source Error:

is supposedly the

Here's the code in my class

public class clsDataLayer

public static dsUser VerifyUser(string Database, string UserName, string UserPassword)
dsUser DS;
OleDbConnection sqlConn;
OleDbDataAdapter sqlDA;
// Connects to the DB
sqlConn=new OleDbConnection("PROVIDER=Microsoft.ACE.OLEDB.12.0;" +"Data Source=" +
sqlDA=new OleDbDataAdapter("Select AccessLevel from UserInfo"+
"Where UserName like " + UserName+"' "+
"and UserPassword like '"+UserPassword+"'",sqlConn);
DS= new dsUser();
return DS;


Answer Source

Try this

sqlDA=new OleDbDataAdapter("Select AccessLevel from UserInfo"+
           " Where UserName like '" + UserName+"' "+
           " and UserPassword like '"+UserPassword+"'",sqlConn);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download