File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes sql date Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "sql date" Watch "sql date" New topic

sql date

Aneresia White

Joined: Dec 06, 2008
Posts: 12
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).
Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 33119

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.

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
Jaya Latha

Joined: Dec 30, 2008
Posts: 1
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

Joined: Dec 06, 2008
Posts: 12
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.
Rene Larsen
Ranch Hand

Joined: Oct 12, 2001
Posts: 1179

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 ]

Regards, Rene Larsen
Dropbox Invite
Aneresia White

Joined: Dec 06, 2008
Posts: 12
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.
I agree. Here's the link:
subject: sql date
It's not a secret anymore!