File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes Syntax Error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Syntax Error" Watch "Syntax Error" New topic

Syntax Error

amit bhadre
Ranch Hand

Joined: Jan 23, 2006
Posts: 124
the code of query is as follows....

resultSet=statement.executeQuery("select Candidate_id,Candidate_Interview_Date ,Candidate_Interview_Result,Candidate_Interviewer_Name,Candidate_Feedback from CANDIDATE_INTERVIEW_RECORD inner join cms_candidate on cms_candidate.'"+CandidateID+"' = CANDIDATE_INTERVIEW_RECORD.'"+CandidateID+"'");


[Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near '189'.

Here I am passing 189 as string to CandidateID variable.

thanks in advance if u tell correct syntax please.

amit bhadre

Thanks advance who ever answers this question.

amit bhadre
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
cms_candidate.'"+CandidateID+"' = CANDIDATE_INTERVIEW_RECORD.'"+CandidateID+"'");

This looks strange. Are you trying to dynamically set the attributes you're comparing? But that wouldn't be named '189', right? Even if it was, the single quotes are incorrect there.
Wei Dai
Ranch Hand

Joined: Jun 22, 2005
Posts: 86
>on cms_candidate.'"+CandidateID+"' = >CANDIDATE_INTERVIEW_RECORD.'"+CandidateID+"'");
Maybe you should use on cms_candidate.CandidateID= ANDIDATE_INTERVIEW_RECORD.CandidateID WHERE cms_candidate.CandidateID="+CandidateID");
subject: Syntax Error
It's not a secret anymore!