Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASP to SQL DB, all events within last 24 hours?

Status
Not open for further replies.

ziggs

Technical User
Sep 21, 2000
195
US
Okay, I'm missing something here.

#1 - Did I set up the "datstring" correctly to define exact time 24 hours ago within a SQL Server 2000 database?

#2 - If so, should I use it in the WHERE clause differently?

datestring = DateAdd("h", -24, now())

SQL = SQL & " Where CallReceivedTime > '" & datestring & "'")

Here's the error message I'm getting -

Expected end of statement
/24hrcapture.asp, line 24, column 64
SQL = SQL & " Where CallReceivedTime > '" & datestr & "'")
---------------------------------------------------------------^
 
Nevermind, I had a ) in the wrong place and finally figured it out.
 
Two things, though one may simply be a typo. First, you wrote in your original code:
Code:
SQL = SQL & " Where CallReceivedTime > '" & [COLOR=red]datestring[/color] & "'")
with this in the error code you see:
Code:
SQL = SQL & " Where CallReceivedTime > '" & [COLOR=red]datestr[/color] & "'")
If this is not a typo, then you need to change it to reflect the correct variable. One way to prevent this, incidentally, is to use Option Explicit (if you're not already using it).

The other thing I see is that you have a closing parenthesis at the end of your statement - but no opening parenthesis. And should this be inside your statement or just an error. I would check these two things first and then go from there.

------------------------------------------------------------------------------------------------------------------------
"I am not young enough to know everything."
Oscar Wilde (1854-1900)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top