简体   繁体   English

从数据库检索日期值到jdatechooser

[英]Retrieve date value from database to jdatechooser

I have a form on which I want to access a date from the database and show in jDateChooser for a particular record. 我有一个想要从数据库访问日期并在jDateChooser中显示特定记录的表单。 How do I get the date from the database table and how do I set that date in jDateChooser? 如何从数据库表中获取日期,以及如何在jDateChooser中设置该日期? The datatype on my database is date. 我数据库上的数据类型是日期。

 JDateChooser.setText(a.getValueAt(selectedRowIndex, 5).toString());

this is my code and it produces error. 这是我的代码,它会产生错误。

First what is "a"? 首先,“ a”是什么? For the looks It seems to be a Table(?) 看起来好像是一张桌子(?)

By JDateChooser you mean the netbeans plugin? JDateChooser是指netbeans插件吗? or the JDateChooser from Toedter? 还是Toedter的JDateChooser? or anything else? 还是其他?

You really should provide a mcve 你真的应该提供一个mcve

If you have a JDateChooser from Toedter then you can use something like 如果您有Toedter的JDateChooser,则可以使用类似

JDateChooser.setDate(<Date_from_DB>)

With this little info I can't help you more 有了这些小信息,我无济于事

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM