• 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 wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

out of range

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


i got the these error


filename:::::>>>>true
java.sql.SQLException: Parameter index out of range (1 > number of parameters, which is 0).
at com.mysql.jdbc.PreparedStatement.setInternal(PreparedStatement.java:2085)
at com.mysql.jdbc.PreparedStatement.setString(PreparedStatement.java:1182)
at com.izmocars.inventory.homenet.Test.main(Test.java:69)


give me solution

Regards
Ravi Kumar
[ December 11, 2008: Message edited by: Ulf Dittmer ]
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to JavaRanch.

You need to remove the quotation marks from the parameters. JDBC will automatically add those where necessary.

In the future, please UseCodeTags when posting code of any length. As it was, the code was basically unreadable.

(As an aside, I think you meant to say "please give me a solution".)
 
D Ravi Kumar
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Simply change the below statement

statement.executeUpdate();

your statement is
statement.executeUpdate(query);

remove the "query"
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic