View Single Post
  #1 (permalink)  
Old 02-25-03, 04:43
fabs fabs is offline
Registered User
 
Join Date: Feb 2003
Posts: 1
Incorrect syntax near '#'

In VB, I can write an SQL query that goes like this:

“SELECT * FROM Staff WHERE HiredDate BETWEEN #10/23/2002# AND #10/29/2002#”

and it works perfectly. However, if I run that same query from an ASP page, I get the following error message:

Microsoft OLE DB Provider for SQL Server (0x80040E14)
Line 1: Incorrect syntax near '#'.

If I type

“SELECT * FROM Staff WHERE Name = ‘John’”

it works perfectly. The error is obviously related to the date literal. Do you know how I could create an SQL expression that will return records between two specified dates?
Reply With Quote