Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void insertSprint(String name, Date start, Date end,long duration, int proj_ID){
- Connection con=null;
- try{
- proj_ID=1;
- Class.forName("com.mysql.jdbc.Driver");
- con=DriverManager.getConnection("jdbc:mysql://localhost:3306/Collabsoft","root","");
- Statement st = con.createStatement();
- st.executeUpdate("insert into sprints (Title,Start_Date,End_Date,Duration,Proj_ID) values ('"+name+"',"+"'"+start+"',"+"'"+end+"',"+duration+","+proj_ID+")");
- }
- catch(Exception e){
- e.printStackTrace();
- }
- finally{
- try{
- if(con != null)
- con.close();
- }
- catch(Exception e){
- }
- }
- }
- protected void onSubmit()
- {
- String s_Name=(String)sprint.getObject();
- Date s_Date=(Date)start_Date.getObject();
- Date e_Date=(Date)end_Date.getObject();
- long diff = e_Date.getTime()-s_Date.getTime();
- long days = diff/(1000 * 60 * 60 * 24);
- if(s_Name!=null && s_Date!=null && e_Date!=null)
- {
- MySQL.insertSprint(s_Name, s_Date, e_Date, days, 1);
- SprintResult sprintResult = new SprintResult(s_Name,days);
- setResponsePage(sprintResult);
- }
- else if(s_Date.getTime()>e_Date.getTime())
- {
- error("You can't end the sprint before it starts");
- }
- else
- {
- error("Please fill the required fields");
- }
- }
- Error: com.mysql.jdbc.MysqlDataTrunction: Data trunction: Incorrect datetime value 'Thu May 13 00:00:00 EEST 2010 ' for column 'Start_Date' at row1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement