Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Syntax Error

 
amit bhadre
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
>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");
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic