Discussion Locked

setDate in a prepared statement

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

What is the correct syntax to 'setDate' in a prepared statement. I'm including java.sql.*, but keep getting 'cannot resolve symbol' error. Statement syntax is: pstmt.setDate(11,updateRec.dAddDt);
dAddDt is declared as: public Date dAddDt;

Thanks for any help....

5 replies

by palani selvam

hi wzjakarta,

Date dateobj=new Date(int year,int month,int day);
Date dateobj=new Date(1903,3,3);
pstmt.setDate(index, Date dateobj);

Check out this! hope u should be able to work out

Regards
pal

by palani selvam

hi wzjakarta,

/*Date dateobj=new Date(int year,int month,int day);*/
Date dateobj=new Date(1903,3,3);
pstmt.setDate(index,dateobj);

Check out this! hope u should be able to work out

Regards
pal

by wzjakarta

Both answers did not answer my question. I resolved issue myself. There was a conflict in import java.sql.* and java.util.*. No further help is needed. Thanks anyway though.

This discussion is closed to new replies.