Adding a db record using Statement

Hi,

I'm having trouble adding a record into a database. I keep getting the following error:

Exception in thread"AWT-EventQueue-0" java.lang.NullPointerException

at clsDatabase.runQuery(clsDatabase.java:90)

at frmAppointmentAdd.btnAddActionPerformed(frmAppointmentAdd.java:177)

at frmAppointmentAdd.access$100(frmAppointmentAdd.java:12)

at frmAppointmentAdd$2.actionPerformed(frmAppointmentAdd.java:75)

at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)

at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)

at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)

at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)

at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)

at java.awt.Component.processMouseEvent(Component.java:5501)

at javax.swing.JComponent.processMouseEvent(JComponent.java:3135)

at java.awt.Component.processEvent(Component.java:5266)

at java.awt.Container.processEvent(Container.java:1966)

at java.awt.Component.dispatchEventImpl(Component.java:3968)

at java.awt.Container.dispatchEventImpl(Container.java:2024)

at java.awt.Component.dispatchEvent(Component.java:3803)

at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)

at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)

at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)

at java.awt.Container.dispatchEventImpl(Container.java:2010)

at java.awt.Window.dispatchEventImpl(Window.java:1778)

at java.awt.Component.dispatchEvent(Component.java:3803)

at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)

at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)

at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)

at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)

at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)

at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)

...and here's my code. The variable criteria is set to "INSERT INTO Appointment VALUES '00-005','Test Inc.','000-0004','04/15/2006','4:00 PM'"

Any ideas?

int changed;

changed = statement.executeUpdate(criteria);

[2549 byte] By [bcwolfea] at [2007-11-27 1:07:15]
# 1

> Any ideas?

You have a null variable and the error message tells you the line:

at clsDatabase.runQuery(clsDatabase.java:90)

So look at all the variables referenced on that line and fix the problem.

You use System.out.println(...) to display the variable and one of them will say "null".

camickra at 2007-7-11 23:42:28 > top of Java-index,Java Essentials,Java Programming...