I'm getting a NullPointerException when I try to set the first '?' in my prepared statement below.
I'm not sure the syntax is correct.
Also, I'm using SQL Server with an identity key for the first field. Since that first field is auto-generated by SQL Server, I am *not* listing it in the INSERT statement below. (IOW, there are 7 fields in the table, but I'm only specifying 2 through 7 below).
Can anyone see why this statement is failing?
I appreciate any help or advice.
Thanks.
-- Mike
================================================
PreparedStatement updateSchedule = null;
String updateString =
"INSERT INTO schedule VALUES (?,?,?,?,?,?)";
try
{
this.con.prepareStatement(updateString);
updateSchedule.setInt(1,userFK); // NullPointerException happens here.
updateSchedule.setTimestamp(2, sql_evtDate );
updateSchedule.setTimestamp(3, sql_evtDate );
updateSchedule.setTimestamp(4, sql_mtpd );
updateSchedule.setString(5, recurringType);
I'm not sure the syntax is correct.
Also, I'm using SQL Server with an identity key for the first field. Since that first field is auto-generated by SQL Server, I am *not* listing it in the INSERT statement below. (IOW, there are 7 fields in the table, but I'm only specifying 2 through 7 below).
Can anyone see why this statement is failing?
I appreciate any help or advice.
Thanks.
-- Mike
================================================
PreparedStatement updateSchedule = null;
String updateString =
"INSERT INTO schedule VALUES (?,?,?,?,?,?)";
try
{
this.con.prepareStatement(updateString);
updateSchedule.setInt(1,userFK); // NullPointerException happens here.
updateSchedule.setTimestamp(2, sql_evtDate );
updateSchedule.setTimestamp(3, sql_evtDate );
updateSchedule.setTimestamp(4, sql_mtpd );
updateSchedule.setString(5, recurringType);