This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Soft Skills and have John Sonmez on-line!
See this thread for details.
The moose likes JDBC and the fly likes Syntax Error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Syntax Error" Watch "Syntax Error" New topic
Author

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+"'");

Error:

[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.

regards
amit bhadre


Thanks advance who ever answers this question.


regards
amit bhadre
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42918
    
  68
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");
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Syntax Error