Forums Register Login

NullPointer Exception using JDBC

+Pie Number of slices to send: Send
Hi everyone,
i am encountring a very strange problem. I have two textfields tf[0] and tf[1] on a JFrame. Now, when anyone clicks on Ok button(again a component in my frame), the texts of the textfields are compared to values in an excel sheet. If the text entered in textfields already exist in the excel sheet, it generates error. Here is part of my code:


Now, the problem is: whenever i enter a value (already existing in the excel) in tf[1] ie. for Access IP, the code runs perfectly and it displays the error as its supposed to.
But when i enter a value (which is new and doesn't exist in excel) it generates following error:
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
Excel shows the error occurs at the { after the following line:


Please help....

+Pie Number of slices to send: Send
Break that up and add a debug sysout.
+Pie Number of slices to send: Send
Thanks, but its still not working....
Do you know why the error is being generated?
+Pie Number of slices to send: Send
 

Paras Ahuja wrote:Thanks, but its still not working....
Do you know why the error is being generated?


ItDoesntWorkIsUseless
Copy paste the full stack trace. The error indicates some variable is null.
+Pie Number of slices to send: Send
Probably rs.getString(1) returns null.
New rule: no elephants at the chess tournament. Tiny ads are still okay.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 827 times.
Similar Threads
ATM machine
how to fix the JLabel Text value in Swings
having problems getting my Runnable Interface working
SWING GUI ADVICE,PLEASE
SWING GUI ADVICE,PLEASE
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 02:13:39.