Date into db and JDBC

  • (2 Pages)
  • +
  • 1
  • 2

22 Replies - 306 Views - Last Post: 09 February 2019 - 04:54 PM Rate Topic: -----

#16 habiler   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 19
  • Joined: 17-October 16

Re: Date into db and JDBC

Posted 09 February 2019 - 02:47 PM

nOW i HAVE

Débutcom.toedter.calendar.JDateChooser[JDateChooser,238,161,100x28,invalid,layout=java.awt.BorderLayout,alignmentX=0.0,alignmentY=0.0,[email protected],flags=8388616,maximumSize=,minimumSize=,preferredSize=]
Was This Post Helpful? 0
  • +
  • -

#17 NormR   User is offline

  • D.I.C Lover
  • member icon

Reputation: 757
  • View blog
  • Posts: 5,711
  • Joined: 25-December 13

Re: Date into db and JDBC

Posted 09 February 2019 - 03:00 PM

Quote

nOW i HAVE

Which print statement printed that output?
There are many print statements that all print the same thing.
How do you know which one was executed?

This post has been edited by NormR: 09 February 2019 - 03:01 PM

Was This Post Helpful? 0
  • +
  • -

#18 habiler   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 19
  • Joined: 17-October 16

Re: Date into db and JDBC

Posted 09 February 2019 - 03:07 PM

This one.
    try {
        PreparedStatement ps = conn.prepareStatement("insert into Beslissing (Dos_Id, Matricule, Debut) values (?,?,?)");  
        ps.setInt(1, Integer.parseInt(txtDos_Id.getText()));
        ps.setInt(2, Integer.parseInt(txtMatricule.getText())); 
        ps.setDate(3,new java.sql.Date(txtDebut.getDate().getTime()));

          System.out.println("Début :   " + txtDebut);
        ps.executeUpdate();
        

But now my db is populated with the data. But the remark still appears
Was This Post Helpful? 0
  • +
  • -

#19 NormR   User is offline

  • D.I.C Lover
  • member icon

Reputation: 757
  • View blog
  • Posts: 5,711
  • Joined: 25-December 13

Re: Date into db and JDBC

Posted 09 February 2019 - 03:17 PM

Quote

the remark still appears

What is the remark?


Quote

This one.

      System.out.println("Début :   " + txtDebut);



That statement does not print what you said was being printed:

Quote

Débutcom.toedter.calendar.JDateChooser[JDateChooser,238,161,100x28,invalid ...

This post has been edited by NormR: 09 February 2019 - 03:19 PM

Was This Post Helpful? 0
  • +
  • -

#20 habiler   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 19
  • Joined: 17-October 16

Re: Date into db and JDBC

Posted 09 February 2019 - 03:55 PM

By debugging my code i reveive this remark :

Début :
com.toedter.calendar.JDateChooser[JDateChooser,238,161,100x28,invalid,layout=java.awt.BorderLayout,alignmentX=0.0,alignmentY=0.0,[email protected]
Was This Post Helpful? 0
  • +
  • -

#21 NormR   User is offline

  • D.I.C Lover
  • member icon

Reputation: 757
  • View blog
  • Posts: 5,711
  • Joined: 25-December 13

Re: Date into db and JDBC

Posted 09 February 2019 - 04:05 PM

Is that what you expected to see printed?
Was This Post Helpful? 0
  • +
  • -

#22 habiler   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 19
  • Joined: 17-October 16

Re: Date into db and JDBC

Posted 09 February 2019 - 04:09 PM

Now I expect to see the content of txtDebut
Was This Post Helpful? 0
  • +
  • -

#23 g00se   User is offline

  • D.I.C Lover
  • member icon

Reputation: 3617
  • View blog
  • Posts: 16,596
  • Joined: 20-September 08

Re: Date into db and JDBC

Posted 09 February 2019 - 04:54 PM

Quote

Now I expect to see the content of txtDebut


Then you'd probably have to call System.out.println("Début : " + txtDebut.getText());

( i don't know that API, so that's a guess)
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2