Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Insert Date With Time Prepared Stament...?

 
jawwad ahmed
Ranch Hand
Posts: 179
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well i am not able to insert date with time with prepared stament.I dont know where i am going wrong.It gives error missing comma.

String qury = "insert into schedule (schedule_id,account_id,schedule_title,remarks,detail,to_date(schedule_date,'DD-MON-YY HH:MI')) values (?,?,?,?,?,?)";
PreparedStatement stmt2=dbConnection.prepareStatement(qury);
stmt2.setInt(1,maxid);
stmt2.setString(2,accountId);
stmt2.setString(3,title);
stmt2.setString(4,remarks);
stmt2.setString(5,detail);
stmt2.setString(6,"03-APR-03 12:12");
int res=stmt2.executeUpdate();

response.sendRedirect("home.jsp");
////////////////////////////////////////////////////
 
SJ Adnams
Ranch Hand
Posts: 925
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
use setDate()
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic