General Forum - Forums about everything!




Databases Discuss development and maintenance of various database types.

Go Back   GeneralForum.com > General > Technology > Computers > Databases

Waterproof
Hearing Aid
Your Ad Here! Online Colleges
& Degrees
WOW Gold Buy WOW Gold

» Sponsored Ads
 



  
You are currently viewing our forums as a guest which gives you limited access to view most discussions, articles and access our other features.

By joining our free community you will have access to post threads, communicate privately with other members (PM), respond to polls, take part in contests, and access many other special "members only" features.

Registration is fast, simple and absolutely FREE so please, join our community today!

If you have any problems with the registration process or your account login, please contact support.

Reply
 
LinkBack Thread Tools
Old 06-18-2008, 03:46 AM   #1 (permalink)
Boredie
In need of Entertainment
Boredie's Avatar
Posts: 1,613
My Mood:
Date Range Problem

I see I'm the first to post in this sub-forum.
I wonder if it's worth the typing. LOL
Well here is the problem:
I have a db with dates.
I have an sql select statement that is able to select records with a range of dates.
The problem occurs when I choose a range of dates from 2 different months.
Code:
rs.open "select * from Timing where ProjectName='"&request.form("projs")&"' and [Date]<=#"&request.form("date2")&"# and [Date]>=#"&request.form("date1")&"# order by [Date],ProjectName asc", Conn
%>
    <table border=1 width=40%><caption>date range: <%=request.form("date1")%> - <%=request.form("date2")%></caption>
    <tr><th>code</th><th>project</th><th>date</th><th>time</th><th>employee</th></tr>
    <%    
    while not rs.eof
    %>
        <tr><td><%=rs("ProjId")%>&nbsp;</td><td><%=rs("ProjectName")%>&nbsp;</td><td><%=rs("Date")%>&nbsp;</td><td><%=rs("Amount")%>&nbsp;</td><td><%=rs("WorkerId")%>&nbsp;</td></tr>        
    <%
    rs.movenext
    wend
    %>
    </table>
When I choose dates in the same months I get the display I need.
When I choose dates in different months it will not display the info. It doesn't give an error, it just doesn't display the range of requested dates (and I've checked to see if this range exists in the db). I've also tried putting the requested dates in the sql statement with the same result.

Any suggestions?
------
I got a response in another forum with a solution.
I needed to use the BETWEEN option.
Code:
select * from --- where [date] between date1 and date2

Bored out of my mind.

Last edited by Boredie; 06-18-2008 at 03:46 AM. Reason: Automerged Doublepost
Boredie is offline Add to Boredie's Reputation   Reply With Quote


Reply

  GeneralForum.com > General > Technology > Computers > Databases

« - | - »
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Spring 2008 Anime Season Vegito728 Anime 13 04-14-2008 08:21 PM
a problem newgirlintown Advice Board 13 02-16-2008 09:18 AM




All times are GMT -6. The time now is 09:21 PM.

Your Ad Here

Powered by: vBulletin | Copyright ©2000 - 2007, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.1.0
Site designed and maintained by NURV® Original Concepts, Graphics, and Design Copyright © NURV® 2008
All user submitted content, threads and posts becomes the copyright-protected property of GeneralForum.com unless previously copyrighted.
The views and opinions expressed on this site are not necessarily the views of the staff or administration.
We are not responsible, nor can we be held liable for information posted on this site, or what it influences you to do.
Rules & Privacy Policy

Waterproof Hearing Aid | Poker Design | Web Design | Game Forum | Pop Culture News | Money Forum | Money Complex | Stephen King