• 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:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

data mismatch error

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Im writing a simple program to read and write from a database.I keep getting an error which I dont understand [Data mismatch in criteria section]....when I try to run the getProduct...Can anyone help.Thanx in advance



[ November 16, 2004: Message edited by: Bear Bibeault ]

[edited subject and added code tags - jeanne]
[ November 16, 2004: Message edited by: Jeanne Boyarsky ]
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For future reference the topic title of Help does not help you but hurt you. Use a more detailed string of words!

Your error sounds like you are using the wrong type when you are passing parameters to your database. Using a double when it is looking for an integer or an integer when it is looking for a string.

Just an idea.

Eric
 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
http://www.frontpagewebmaster.com/m-178811/tm.htm

Here is a case of a similar error
 
author & internet detective
Posts: 42055
926
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Roberto,
In the query, you have id has a string:
String query = "SELECT * from Product WHERE id = '" + item + "'" ;

but in the result set it is an int:
int id = rs.getInt("id") ;

One of these needs to be changed.
 
Politics n. Poly "many" + ticks "blood sucking insects". Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic