adding TIMESTAMP

Hi,

I am currently trying to add a timestamp+(variable) to my mssql database via a JSP. I can add the simple time stamp by doing the following:

...

PreparedStatement ps = connection.prepareStatement("INSERT INTO table1 VALUES (?,?,?, CURRENT_TIMESTAMP+5)");

...

...which adds 5 days to the current date. However if i wanted to replace '5' with a variable how do i go about doing this. i have tried for example:

...

String extraDays = 5;(just for example)

...

PreparedStatement ps = connection.prepareStatement("INSERT INTO table1 VALUES (?,?,?, CURRENT_TIMESTAMP+extraDays)");

...

also tried by replacing with:

CURRENT_TIMESTAMP+"extraDays"

CURRENT_TIMESTAMP+'extraDays'

but none of them seem to work.

Any help would be gladly appreciated.

[845 byte] By [haggard17a] at [2007-11-27 10:00:32]
# 1
This is the right forum in future for JDBC questions but you already cross posted this (and it was answered) in the Programming forum. Please return to that thread where I already answered. http://forum.java.sun.com/thread.jspa?threadID=5192826
cotton.ma at 2007-7-13 0:31:52 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...