Win a copy of Head First Android this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

problem with syntax for SQL statement

 
Ranch Hand
Posts: 149
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The method below is used as part of a search facility for my web site. I'm getting this error message:
org.apache.jasper.JasperException: Column not found, message from server: "Unknown column 'origin' in 'where clause'"

This is my code for the method:


Country and Type are defined as columns within the exsisting table within the DB.
Any ideas?
[ May 03, 2003: Message edited by: Rob Petterson ]
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try this instead:

String literals need to be single quoted. If you would be using a PreparedStatement, then you would not use the single quotes but with a regular Statement, you must.
 
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually you have 2 errors in your SQL statement. Since origin, and coinType are parameters, try this:

[ May 03, 2003: Message edited by: Irene Loos ]
 
Rob Petterson
Ranch Hand
Posts: 149
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Lasse and Irene for you're help. You were right Irene, there were a couple of mistakes in my syntax. You wouldn't believe how long I spent yesterday trying to figure it out! It works fine now. I've got one more of those methods to overload for a more complex search query, so at least now I've got a fair shot at getting it to work with your previous help. Thanks again.
[ May 04, 2003: Message edited by: Rob Petterson ]
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic