aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes How to fetch date from database in JDateChooser field Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "How to fetch date from database in JDateChooser field" Watch "How to fetch date from database in JDateChooser field" New topic
Author

How to fetch date from database in JDateChooser field

Fahim Khan
Greenhorn

Joined: Nov 08, 2012
Posts: 2
Hi,
I have created simple form in swing. Which uses JCalendar.

I am trying to view the data from database on the basis of id. All other field are listing fine except date field. Which is JDateChooser component.

I am using below code to set the field.


Thanks in advance
Kemal Sokolovic
Bartender

Joined: Jun 19, 2010
Posts: 825
    
    5

Hello and welcome to the Ranch!

Can we see the exception message you are getting? I guess tfdob is JDateChooser component?


The quieter you are, the more you are able to hear.
Fahim Khan
Greenhorn

Joined: Nov 08, 2012
Posts: 2
Yes, it is JDateChooser componet.

I am getting SQLException from line tfdob.setDate(rs.getDate("DOB"));

I think I got the solution I have defined DOB as String in database that may causing exception
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to fetch date from database in JDateChooser field