• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Select query using Prepared Statement

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I do not know what is wrong in my code. Following are the conditions in my code given below:

I will enter the customer id in the jTextField
After Entering the customer id then in the Database it will search relative information of that customer id (customer_id,customer_name,customer_contact).
After Collecting relative information of that particular customer id, it will display on the jTextField.
These is my code given below:

 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What, exactly, does the code do now, and how is that different from what you were expecting it to do? At which point does the code's behavior start to deviate from your expectation?

Is the actionPerformed method ever being called? Is the "try" block in line 75 ever being executed? Also, you should print out the full stack trace in the catch handler in line 102. Currently the code discards all information that would help you debug this issue.
 
Deva Devaa
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am getting error in line no 86


 
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
... but you won't tell us what the error is? Post the full stack trace.
 
Deva Devaa
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
error



You clicked the button
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at customer_details.actionPerformed(customer_details.java:85)
 
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
So which object is null? My guess is it's "rs1", because the code you posted never assigns something other than "null" to it.
 
Deva Devaa
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I corrected My Code as:


Now Query is run successfully but the result it not show in the jtextfield
 
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
Have you checked that all the records that you think should be returned by the query are in fact being returned by the query?
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic