java - Insert null into Date/Time field in MS Access- -
i have been trying insert null
values date/time
column in ms access keep on getting error
below variants on how set null values
string processeddate = ""; // doesn't work string processeddate = null; // doesn't work
the error during sql insert
java.sql.sqlexception: [microsoft][odbc microsoft access driver] data type mismatch in criteria expression
my insert query written in java
insert donordetails ([signup date],remarks, [date processed])values ('25/03/2014','','')
do have explicitly construct sql statement without [processed date] column when know value null ? or there easier way ?
it's not clear how constructing query, habit create prepared statement this:
preparedstatement ps = connection.preparestatement("insert donordetails (signup_date, remarks, date_processed) values (?,?,?)"); ps.settimestamp(1, sometimestamp); ps.setstring(2, someremark); ps.setnull(3, types.timestamp);
this won't dependent on database , driver used , solves problems inserting null(see last line).
p.s. don't know brackets([]
) mean in insert guessed column names
Comments
Post a Comment