*
The moose likes JDBC and the fly likes sql date Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "sql date" Watch "sql date" New topic
Author

sql date

Aneresia White
Greenhorn

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
internet detective
Marshal

Joined: May 26, 2003
Posts: 30068
    
149

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.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Jaya Latha
Greenhorn

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
Greenhorn

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
Greenhorn

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: http://aspose.com/file-tools
 
subject: sql date
 
Similar Threads
Dealing with results of java time code
Display currnet day,moth, and year in combobox separately
java.text.SimpleDateFormat
Crazy date program
invoke functions in a jpl query