• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

sql date

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I want to get the day, month and year from combo boxes and making an update in my database after this date. I tried something like this:

can is the combo box for year, czi for day and cluna for month.
It doesn't work like this, I receive an error. I think it should be something else instead of (String).
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Aneresia White:
I receive an error.


What was the error? Sharing this information will make you more likely to get a useful reply.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,Iam Jaya.The problem you mentioned is not the reason why the code is failing.Type casting is possible.They are convertible types.There may be some other reason for the failure.Please give more details.
 
Aneresia White
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So this is the error:

but the syntax is ok I already verify it in sql. if I put (Date) instead of (String) I don't get any errors but the update is not working when I look in the database.
 
Ranch Hand
Posts: 1179
Mac OS X Eclipse IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You need a space between 'where' and 'datav' - and replace the last 'where' with an 'and'.

Normally you will have saved the date as a DATE or TIMESTAMP field in the database, and in Java you will pass the argument to the Statement as a java.sql.Date
[ December 31, 2008: Message edited by: Rene Larsen ]
 
Aneresia White
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You were right about the space between those 2 ) How could I missed that. That's funny. But the last where it's ok, it's what I need it. Thank you.
 
The longest recorded flight time of a chicken is 13 seconds. But that was done without this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic