views:

44

answers:

4

hi all I'm working on asp.net web application & for this use MS access for back end, My Query is given below which is successfully executed on MS Access but error on front end ("Syntax Error in FROM Clause")

select USER.EMPID as EMPID,USER.FULLNAME as FULLNAME,
USER.USERNAME as USERNAME,Employee.ROLEID,ROLE.ROLENAME AS ROLE 
FROM USER 
inner join employee on user.userid=employee.userid 
inner join role on employee.roleid=role.roleid  
WHERE  USER.EMAIL='[email protected]' 
AND USER.PASSWORD='cZdqAEeDV2EVzA1JNFJ6hQ==' 
AND USER.STATUS='Enable'

Any help is greatly appreciated.

A: 

Hey,

I assume user email and password happens to be a parameter that is passed in to the query, or it comes from a variable in code? Maybe there is some formatting issue (like an unhandled ' inside the parameter value) thats causing a syntax error?

Brian
user email and password are parameter that is passed in to the query
amol
This is a comment, not an answer.
David-W-Fenton
Maybe there is a formatting issue with ' was my answer... it just has a ? after it as if a question.
Brian
It's the kind of question asking for clarification that is usually place in a comment. You don't actually provide an answer to the problem.
David-W-Fenton
I don't always do that, but sometimes I answer questions with statements that contain a ? I phrase things differently than most people; I'm saying that I believe that there is an extra '. That is my answer, even though it has an ? at the end.
Brian
+1  A: 

As a general rule, I would advise that you build your query using MS Access.
Build it in Design view, test in in Dataheet view, then switch to SQL view and copy paste SQL stqtement to you app.
This way you will avoid a lot of errors.

iDevlop
...in particular it will avoid Jet/ACE's pickiness about parentheses on the JOINs in the FROM clause.
David-W-Fenton
A: 

I am very surprised the query works for you. Access is fussy about parentheses and you are missing some:

Select USER.EMPID as EMPID,USER.FULLNAME as FULLNAME,
USER.USERNAME as USERNAME,Employee.ROLEID,ROLE.ROLENAME AS ROLE 
FROM (USER 
inner join employee on user.userid=employee.userid )
inner join role on employee.roleid=role.roleid  
WHERE  USER.EMAIL='[email protected]' 
AND USER.PASSWORD='cZdqAEeDV2EVzA1JNFJ6hQ==' 
AND USER.STATUS='Enable'
Remou
Would the person who down voted care to explain how they succeeded in running an ms-access query that leads to missing operator error in both plain Access and ANSI 92 mode, please? Regarding the use of the keyword user, square brackets around it will correct the problem, though renaming is preferable.
Remou
Here's a free upvote to counteract the asshole.
David-W-Fenton
@David-W-Fenton Thanks, David. It should be helpful to readers who wonder why they cannot get away with missing brackets :D
Remou
A: 

I changed the name of my user table to users & update query regarding this change & problem resolve successfully.

amol