A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Android Security Essentials Live Lessons
this week in the
JDBC MS Access Date comparison
Joined: Dec 09, 2000
Jul 24, 2005 12:34:00
I am accessing an MS Access database via
I can happily connect and retrieve a result set and even subset the results with
Now...each record contains a MS Access "Date/Time" field.
How can I specify in my SQL in my
method, that I only want to retrieve records that are newer than a given, date?
I am creating a string that stores my SQL query and passing this to the executeQuery() method.
I suppose I need to A) Define my comparisn date and then B) somehow pass that into my SQL query statement.
I am not sure how to do either...
All assistance is warmly welcomed.
SCJP 1.4 (93%)<br />SCJD (In progress. It can run, but it can't hide...)
Joined: May 26, 2003
Jul 24, 2005 18:48:00
Since you are dealing with Dates, you will want to use a PreparedStatement. This lets the driver handle all the icky date details for you.
The query would go something like this:
"select columns from table where date_column > ?"
Then you can call:
For more details on the PreparedStatement, check the
How To Ask Questions The Smart Way
Blogging on Certs:
SCEA Part 1
Part 2 & 3
Core Spring 3
TOGAF part 1
subject: JDBC MS Access Date comparison
parsing in servlet
JDBC connection to MS SQL Server .. HELP
Access Data source using program
time for database access
how to update multiple table in frame
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014