Results 1 to 6 of 6
  1. #1
    ashin is offline Member
    Join Date
    Nov 2008
    Posts
    71
    Rep Power
    0

    Default How can i save DATETIME to the database?

    guys, how can i save the datetime format to database? i always got an error DUPLICATION in id..:confused:
    :cool:

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    I think that you're going to have to show some code as well as the error message itself (not your interpretation of the message).

  3. #3
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

  4. #4
    ashin is offline Member
    Join Date
    Nov 2008
    Posts
    71
    Rep Power
    0

    Default

    this is my code part..

    Java Code:
    final DateTime ftime = new DateTime(group,SWT.TIME|SWT.BORDER|SWT.SHORT);
    		ftime.setBounds(130,150,73,23);
    	final DateTime totime = new DateTime(group,SWT.TIME|SWT.BORDER|SWT.SHORT);
    		totime.setBounds(130,180,73,23);
    saving part... bold texts

    Java Code:
    Execute exc = new Execute();
    				exc.ExecuteQuery("INSERT INTO tblfacultyscheduling(sy,courseid,insid,section,timefrom,timeto,day) VALUES('"+cmbSY.getText()+"','"+cmbCourse.getText()+"','"+cmbInsId.getText()
    						+"','"+cmbSection.getText()+"','"+[B](ftime.getHours()+":"+ftime.getMinutes())[/B]+"','"+(totime.getHours()+":"+totime.getMinutes())+"','"+cmbDay.getText()+"')",factSched,cmbCourse.getText());
    				exc=null;
    :cool:

  5. #5
    ashin is offline Member
    Join Date
    Nov 2008
    Posts
    71
    Rep Power
    0

    Default

    hi guys, i already solved the half of my problem (no duplication of id anymore) but my problem is, how can i save the whole date to the database? the system can only save the hourse:minutes but the AM/PM is not.. thank you..
    :cool:

  6. #6
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

Similar Threads

  1. Replies: 14
    Last Post: 12-07-2010, 11:41 AM
  2. How to save image in database
    By sandeep23k in forum Advanced Java
    Replies: 3
    Last Post: 08-02-2010, 01:02 PM
  3. how to print the from and to datetime
    By baktha.thalapathy in forum New To Java
    Replies: 1
    Last Post: 06-10-2010, 10:58 AM
  4. Save JTable to database
    By Geraldo in forum AWT / Swing
    Replies: 0
    Last Post: 06-04-2010, 03:03 PM
  5. save file to database
    By katerinaaa in forum New To Java
    Replies: 0
    Last Post: 08-14-2007, 01:15 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •