Hello,
I have had problems with the Date function in Access.
I had a problem with...
sqlString = "SELECT someColumn FROM someTable WHERE something <=
'"+currentObject.reservationSQLDate+"'";
My error was a MS Access sql error like... mismatch data type error or
something like that. For some reason it worked with UPDATE and INSERT but
not SELECT. Again, it only happen when I used the conditional.
So,
I found out that Access requires its dates to be bracketed by #'s like:
#aDate# instead of the 's like 'aDate'.
To make a long story short I changed the ' to # and it worked. Not sure if
this is your problem, but I thought some one else might have the same as I
did. I also found it neccessary to write a helper method that converted the
java.util.Date object to a java.sql.Date object...same for the java.sql.Time
object. So my final string became:
sqlString = "SELECT someColumn FROM someTable WHERE something <=
#"+sqlDate(currentObject.reservationSQLDate)+"#";
--brian
>From: Chris Pratt <[EMAIL PROTECTED]>
>Reply-To: "A mailing list for discussion about Sun Microsystem's Java
> Servlet API Technology." <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>Subject: Re: DATE Problem!!!!!!!!!!!
>Date: Thu, 4 Nov 1999 09:55:59 -0800
>
>The easiest, and most portable, way to do this is using a PreparedStatement
>and the setDate method. This takes a regular Date object and it's the JDBC
>Drivers job to put it into the proper format for the particular database.
> (*Chris*)
>
>----- Original Message -----
>From: Tom John <[EMAIL PROTECTED]>
>To: <[EMAIL PROTECTED]>
>Sent: Thursday, November 04, 1999 1:38 AM
>Subject: DATE Problem!!!!!!!!!!!
>
>
> > Hi
> > In my servlet I have to save a aparticular Date value to the table
>called
> > day_table the problem
> > is the table is created usinf MicroSoft Access 97, the Table has a field
>of
> > date type(infact the data type is Date/Time and Format is Short Date eg
> > 6/19/94)
> >
> > The Table has four fields.
> > file://---------------------------
> > ...
> > ....
> > ..
> > ..
> > Date date=new Date(1999,4,2);
> > stmt2.executeUpdate("insert into day_table values (date,'Monday',4,5)");
> > ....
> > ..
> > file://This code gives Errors-------------------------
> >
> >
> >
> > I do have two main Questions
> >
> > (1) How can I store the Date value to the table as above Which was not
> > successful it gives Errors
> >
> > (2)How can I store Year 2000 in Access . That is after instantiating as
> > Date mydate=new Date(2000,4,5)
> >
> > (3)if the user/client enters the date value thruogh a HTML form
> > how can store that value to this Database
> >
> >
> > Should I move to ORACLE for this task to be done.
> >
> >
> > thnaks in Advance
> >
> > Tom
> >
> >
>___________________________________________________________________________
> > To unsubscribe, send email to [EMAIL PROTECTED] and include in the
>body
> > of the message "signoff SERVLET-INTEREST".
> >
> > Archives: http://archives.java.sun.com/archives/servlet-interest.html
> > Resources: http://java.sun.com/products/servlet/external-resources.html
> > LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
> >
>
>___________________________________________________________________________
>To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
>of the message "signoff SERVLET-INTEREST".
>
>Archives: http://archives.java.sun.com/archives/servlet-interest.html
>Resources: http://java.sun.com/products/servlet/external-resources.html
>LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html