Solved

Q for TimYates/Ken/kludeep

Posted on 2003-11-27
12
303 Views
Last Modified: 2010-04-01
I am following ChainReaction's q previously and i fee curious and try it out my own. Yet, i found the same error like he did... and it's not good for me to tap into his question.. hope 3 of us can help me as well...

ha..

I have create the same DB he have, Access, with Date(InsDateA) and datatye is date.
this is my code:


   PreparedStatement ps = conn.prepareStatement( "SELECT * FROM PURCHASE WHERE "+
    " (ExpDateA > ? AND ExpDateA < ?)" ) ;  
 
   ps.setDate( 1, new java.sql.Date( sdf.parse( startdate ).getTime() ) );
   ps.setDate( 2, new java.sql.Date( sdf.parse( enddate ).getTime() ) );

rs=ps.executeQuery();
int counter=0;
while (rs.next()){
    counter++;
    out.println("<BR>");
out.println(counter + ":"+ rs.getString("Customer") + vf.format(rs.getDate("ExpDateA")));
vf.format(rs.getDate("ExpDateB")) );
    out.println("<BR>");

this is the rawdata.
ExpDateA
11/27/2004
11/26/2005
11/20/2003
12/18/2003
11/24/2003

And this is my result page:

Start Date : 01/11/2003 End Date : 30/11/2003

1:AGNES TAN27/11/2004

2:KIMURA20/11/2003

3:KAWASKI24/11/2003

4:NAKATA18/12/2003

ha.. the first data shouldnt come out.. but i couldn't notice what went wrong... i did try whay TimeYates explain to Chainreaction, but i think i have the same problem with him... :-)

if i change the query again...
Start Date : 01/11/2003 End Date : 15/11/2003

1:KIMURA20/11/2003

2:KAWASKI24/11/2003

3:NAKATA18/12/2003

Again... all the the data is wrong...
:-(
Can guide me as well?
0
Comment
Question by:kotakinabalu
  • 4
  • 3
  • 2
  • +2
12 Comments
 
LVL 35

Expert Comment

by:TimYates
ID: 9831184
What do you get typing this query straight into access?

You sure your field is set up as a "Date" field?
0
 
LVL 19

Expert Comment

by:Kuldeepchaturvedi
ID: 9831266
Yeah now the best thing for me is to do it all by myself and test it out...:-)
But its late here and I got my Bday to celebrate so I gonna look into it tommorow... Till then...
have a good time...
0
 
LVL 14

Expert Comment

by:kennethxu
ID: 9831275
>> I have create the same DB he have, Access, with Date(InsDateA) and datatye is date.
could you make sure that ExpDateA is also date type?
0
ScreenConnect 6.0 Free Trial

Check out the updates in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI that improves session organization and overall user experience. See the enhancements for yourself!

 

Expert Comment

by:chainreaction
ID: 9831491
>>as I told you, forget about the "format" in database, only stay with the format you use in JSP.

This is the best i can share with you........ from ken..
0
 

Expert Comment

by:chainreaction
ID: 9831500
kuldeep, HAPPY BIRTHDAY TO YOU!!!!
0
 
LVL 14

Expert Comment

by:kennethxu
ID: 9831512
oh, it's kuldeep's birthday? my I join the party? Happy Birthday! kuldeep!
0
 
LVL 35

Expert Comment

by:TimYates
ID: 9831513
Woo

*puts on hat*

Happy birthday!! :-)

Tim
0
 
LVL 14

Expert Comment

by:kennethxu
ID: 9831518
what about a small gift? points to kuldeep!
0
 
LVL 19

Accepted Solution

by:
Kuldeepchaturvedi earned 250 total points
ID: 9835170
Oh wow! so sweet of you all.......
Thanks for the wishes............ So since chainreaction's question is solved I reckon this is also done.. or am I still in hang over....????????
0
 

Author Comment

by:kotakinabalu
ID: 9835835
ha.. kludeep, in fact i am waiting for you to come back here to "feel" the warmest of this peoples...

yeah.. my error sovled also...

Thank you to all of you...

:-)
0
 
LVL 19

Expert Comment

by:Kuldeepchaturvedi
ID: 9838967
Thank you all for your wonderfull wishes and for points too....:-)
anybody interested in riddles go to www.riddleplanet.com and when you crack the second riddle of second round in contest 2.. then do let me know...
Its stumping me for good 5 days....

cheers
0
 
LVL 14

Expert Comment

by:kennethxu
ID: 9840563
I think it's nearly half day after you post the riddles link, I'm now on 2.1.16, I'm afraid I don't have enough time to carry on but enjoyed. :-)
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
AlarmClock Challenge 35 150
IE doesn't Invoke servlet in iframe 1 111
Handle form fields in spring mvc controller 1 64
Java Script nested call 3 86
Read about the ways of improving workplace communication.
SEO can be a real minefield to navigate, but there are three simple ways to up your SEO game just be re-assessing your content output.
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question