I have a need to use Statement.executeUpdate() to insert data into Database.
So every parameter must be embeded into a SQL string.
In Database, the type of two columns are datetime: Date1 and Date2
At client side, if I use following statement:
String SQLString = "INSERT INTO Position (" +
......
"Date1, " +
......
"Date2) " +
"VALUES(" +
......
//"2012-05-29 16:28:58.555" + ", " + // runtime error, always say error at 16
//"2012-05-29" + ", " + // no runtime error, but lost time and result date is also not correct
//"10-06-02" + ", " + // no runtime error, but it adds 2 days beginning at 1900-01-01 00:00:00.000
......
null
")";
Can anyone tell me how to correctly embedded Datetime into SQL String?