ProgramWindowJava

JDBC problem: NullPointerException

I'm coding a jdbc program with jdk1.4.1 and ms/access .

The viewing of the contents of each table in the database is running well.
Viewing is designed as a table and also row by row.

For inserting data row by row in a selected table i used an "addnext" button
whose function is to fetch the values from all the rows ,insert them into
the table and clear up the text fields for the user to enter new data.

While running, when i press the "addnext" button problem occurse.

The console gives the following message:

java.lang.NullPointerException
at additionframe$3.run(test2.java:832)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:448)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchTh
read.java:197)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre
ad.java:150)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:144)


I don't have well knowledge abt threads.

Can u please suggest a solution.

The code is given in the attachment addfrm.txt

Replay:JDBC problem: NullPointerException
I believe it to be that the run method uses this line:

addpanel.addRow(rs,tableName);

but nowhere do i see that object "addpanel" initiated. So when you click the button, it is trying to perform a task on a null object, try initiating it.

Replay:JDBC problem: NullPointerException
I Tried to initialise the addpanel (see the comment /*///initialising///*/
in the attachment) but the same message is given in the console.
Is the initialisation not correct?

Are u getting the code in a formatted way (or
jambled in a single page)?

If u want to check i can send u the entire code.

Replay:JDBC problem: NullPointerException
Quote:
Originally posted by progprob
[b]I'm coding a jdbc program with jdk1.4.1 and ms/access .



that code is a total mess, and i get the impression that you've written nearly the entire thing into one java file.. as a result, i cant really tell what is where.. or why you've posted additionframe.txt when the error is on test2.java, in inner class additionframe, in anonymous inner class number 3 (which i think is the window adapter)

i dont think youre doing yourself any favours adopting this coding style.. use separate files for all your classes!



Java

Writing a database
Declaring an array help
CMP and database connection problem
Need help with methods
Need help with this Code, please.
Threads
My first program.
memory address?
executable java file
Bitwise comparison?
Can't figure out Static Error?
Help!! using recursion to search an array
Encrypt / Decrypt homework help
Menus
help!!!!!!!!!!!!!!!
How to access JSpinner's JTextField?
easy questions
recursion/iterator problem
repainting the whole frame??
Help Wih Chessboard Problem