Click here to Skip to main content
15,889,281 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I am getting this Exception When I run the Program.

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'leave on users.Id=leave.UserId' at line 1

string query = "SELECT *FROM users INNER JOIN leave on users.Id = leave.UserId";

this is the Query
How to resolve this problem please give solution.
Posted
Comments
Thanks7872 23-Sep-13 2:11am    
Errors are meant for some thing. If you are advised to correct syntax some where,you know where the problem is,than i think everything is clear? Error says that,you should rectify your query which is not appropriate.

1 solution

Try escaping the names of tables and columns. Perhaps leave is a keyword in mysql:
SQL
SELECT * FROM `users` INNER JOIN `leave` on `users`.`Id` = `leave`.`UserId`
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900