Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Syntax error in SQL query

 
Donna Harrington
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey everybody,
Can ye help me please. I can't seem to see my syntax error in this sql query. When i compile my application it says i've a syntax 'comma' error.
Here it is:
PreparedStatement pstmt = conn.prepareStatement(" DELETE FROM TitleTable WHERE titleId = '" +tit+"', name= '"+name+"', genre ='"+genre+"', cert = '"+cert+"', rating ='"+rating+"', yearOfRelease ='"+yearOfRelease+"',synopsis = '"+synopsisOfVideo+"';");
Thanking u in advance
Donna
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am pretty sure that instead of a comma you need to use the keyword AND. Try that and let me know.
 
Donna Harrington
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Brilliant Gregg Bolinger..Thanx a million for ur help!
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No problem.
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!