| Author |
date and query
|
mark smith
Ranch Hand
Joined: Apr 05, 2005
Posts: 240
|
|
hi i have problem to use a date in a query i get the error: any idea?
|
 |
Kaydell Leavitt
Ranch Hand
Joined: Nov 18, 2006
Posts: 679
|
|
Hi. I think that that the problem is in your select statement. If the datePub field of the database table is a string then your date should be withing single quotes. -- Kaydell
|
 |
Jesper de Jong
Java Cowboy
Bartender
Joined: Aug 16, 2005
Posts: 12929
|
|
This is not a Java problem - it's an SQL problem. Your SQL statement: select * from test where datePub >= 2005-10-01 is not a valid SQL statement. The best way to do queries or updates with parameters in Java is by using PreparedStatement, like this:
|
Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
|
 |
 |
|
|
subject: date and query
|
|
|