• Post Reply Bookmark Topic Watch Topic
  • New Topic

Data truncation:incorrect date value:'null' for column  RSS feed

 
james kinyua
Greenhorn
Posts: 28
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, i have a problem when updating JDateChooser field in Mysql database
Each time i try to upadte i get this error


Kindly assist me.
 
Campbell Ritchie
Sheriff
Posts: 53774
128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And what is the entry in the text field? Which field is missing? Is it the date? Which Date class are you using?
 
Rob Camick
Ranch Hand
Posts: 2754
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Won't solve your problem, but it will make the code easier to understand and maintain.

Try using a PreparedStatement for your SQL:

 
james kinyua
Greenhorn
Posts: 28
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Rob, i used a PreparedStatement for my SQL but am getting an exception


whereas my parameters are 7.





The TextField Contract is where i have my JDateChooser
 
Campbell Ritchie
Sheriff
Posts: 53774
128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
james kinyua wrote:. . .
The TextField Contract is where i have my JDateChooser
What a dreadful name for a date chooser.

If you have 8 ?s in the prepared statement you must pass 8 data to correspond. And they must be the appropriate type. What happens with your cast to SQL date?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!