Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 17th, 2003, 04:10 PM
Registered User
 
Join Date: Nov 2003
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default Getting info from database -between dates

I am trying to get infro between two dates and time.
It starts from 5:00:00 PM yesterday to today 5:00:00 AM.
I tried code blow but it did not worked.
<%
tstart="5:00:00 AM"
tend="5:00:00 PM"

yesterday = CDate(DateAdd("d" , -1, Date()) & " " & tstart)
today = CDate(Date & " " & tend)


Set baglanti=Server.CreateObject("ADODB.connection" )
baglanti.Open "driver={microsoft access driver (*.mdb)}; DBQ=" &Server.MapPath("db.mdb" )
SQL="select * from CallList Where Customer='"& customerid &"' AND RequestedDate BETWEEN #" & yesterday & "# AND #" & today & "# AND [Requested Time] BETWEEN #" & tstart &" # AND #" & tend &"# order by CAD asc"
Set kayitseti = baglanti.Execute(SQL)

%>


 
Old December 22nd, 2003, 05:28 PM
Authorized User
 
Join Date: Dec 2003
Posts: 81
Thanks: 0
Thanked 0 Times in 0 Posts
Default

It looks like you are referencing the beginning time and ending time twice. Is the time part of your date field or is it in a separate time field as indicated by your SQL.

EX BETWEEN " & yesterday & " AND ....
is the time included in the field for yeaterday or is it strictly a date.

Hope this helps

 
Old December 23rd, 2003, 01:02 AM
Registered User
 
Join Date: Nov 2003
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you, it did help, alot
:-)






Similar Threads
Thread Thread Starter Forum Replies Last Post
Retrieve Info from Database miniskirt Classic ASP Basics 0 November 2nd, 2006 04:35 AM
Extracting info from dates spraveens Beginning PHP 7 September 20th, 2004 06:30 AM
Deleting info from Database... jasmine5544 Classic ASP Databases 1 December 2nd, 2003 03:43 PM
HELP! How do I insert info. to a database? nvillare VB.NET 2002/2003 Basics 4 December 2nd, 2003 01:44 PM
HELP! How do I insert info. to a database? nvillare VB Databases Basics 0 November 30th, 2003 04:09 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.