Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: Can anyone see the syntax error?


Message #1 by Ben Greenhouse <b.greenhouse@u...> on Tue, 13 Feb 2001 11:57:10 -0500
Can anyone see the syntax error here?

Error Type:

Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)

[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing

operator) in query expression 'LoyaltyProgramEnddate >= #2/13/2001

11:49:22 AM# and where LoyaltyProgramStartDate <= #2/13/2001 11:49:22

AM#'.



The code is:



SQL7 = "Select distinct * from LoyaltyProgram"

  'New Line to simulate Partner Services Results

  SQL7 = SQL7 & " where LoyaltyProgramEnddate >= #" & Now

  SQL7 = SQL7 & "# and where LoyaltyProgramStartDate <= #" & Now

  'SQL7 = SQL7 & "# and where datediff('d', LoyaltyProgramStartDate, #"

& Today & "#) < 0"

  SQL7 = SQL7 & "# Order by LoyaltyProgramStartDate ASC"

  Set RS7 = Server.CreateObject("ADODB.RecordSet")

  RS7.Open SQL7, DB, 3, 2, 1



Message #2 by "Greg Covey" <gecovey@s...> on Tue, 13 Feb 2001 09:06:33 -0800
Yeah,



You can't have more than one 'where' statement in a SQL

command. Just omit the extra 'where's and you should be OK.



hth,

greg



> -----Original Message-----

> From: Ben Greenhouse [mailto:b.greenhouse@u...]

> Sent: Tuesday, February 13, 2001 8:57 AM

> To: ASP Databases

> Subject: [asp_databases] Can anyone see the syntax error?

>

>

> Can anyone see the syntax error here?

> Error Type:

> Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)

> [Microsoft][ODBC Microsoft Access Driver] Syntax error

(missing

> operator) in query expression 'LoyaltyProgramEnddate >

#2/13/2001

> 11:49:22 AM# and where LoyaltyProgramStartDate <

#2/13/2001 11:49:22

> AM#'.

>

> The code is:

>

> SQL7 = "Select distinct * from LoyaltyProgram"

>   'New Line to simulate Partner Services Results

>   SQL7 = SQL7 & " where LoyaltyProgramEnddate >= #" & Now

>   SQL7 = SQL7 & "# and where LoyaltyProgramStartDate <= #"

& Now

>   'SQL7 = SQL7 & "# and where datediff('d',

> LoyaltyProgramStartDate, #"

> & Today & "#) < 0"

>   SQL7 = SQL7 & "# Order by LoyaltyProgramStartDate ASC"

>   Set RS7 = Server.CreateObject("ADODB.RecordSet")

>   RS7.Open SQL7, DB, 3, 2, 1

>

>
Message #3 by "Wally Burfine" <oopconsultant@h...> on Tue, 13 Feb 2001 19:04:28 -0000
take the 2n where out and make it:





LoyaltyProgramEnddate >= #2/13/2001

11:49:22 AM# and LoyaltyProgramStartDate <= #2/13/2001 11:49:22 AM#





>From: Ben Greenhouse <b.greenhouse@u...>

>Reply-To: "ASP Databases" <asp_databases@p...>

>To: "ASP Databases" <asp_databases@p...>

>Subject: [asp_databases] Can anyone see the syntax error?

>Date: Tue, 13 Feb 2001 11:57:10 -0500

>

>Can anyone see the syntax error here?

>Error Type:

>Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)

>[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing

>operator) in query expression 'LoyaltyProgramEnddate >= #2/13/2001

>11:49:22 AM# and where LoyaltyProgramStartDate <= #2/13/2001 11:49:22

>AM#'.

>

>The code is:

>

>SQL7 = "Select distinct * from LoyaltyProgram"

>   'New Line to simulate Partner Services Results

>   SQL7 = SQL7 & " where LoyaltyProgramEnddate >= #" & Now

>   SQL7 = SQL7 & "# and where LoyaltyProgramStartDate <= #" & Now

>   'SQL7 = SQL7 & "# and where datediff('d', LoyaltyProgramStartDate, #"

>& Today & "#) < 0"

>   SQL7 = SQL7 & "# Order by LoyaltyProgramStartDate ASC"

>   Set RS7 = Server.CreateObject("ADODB.RecordSet")

>   RS7.Open SQL7, DB, 3, 2, 1

>

>
Message #4 by philip.moh@a... on Wed, 14 Feb 2001 08:42:42 +0800
at the end of each SQL statement, try to add this _ 







> -----Original Message-----

> From:	Wally Burfine [SMTP:oopconsultant@h...]

> Sent:	Wednesday, February 14, 2001 3:04 AM

> To:	ASP Databases

> Subject:	[asp_databases] Re: Can anyone see the syntax error?

> 

> take the 2n where out and make it:

> 

> 

> LoyaltyProgramEnddate >= #2/13/2001

> 11:49:22 AM# and LoyaltyProgramStartDate <= #2/13/2001 11:49:22 AM#

> 

> 

> >From: Ben Greenhouse <b.greenhouse@u...>

> >Reply-To: "ASP Databases" <asp_databases@p...>

> >To: "ASP Databases" <asp_databases@p...>

> >Subject: [asp_databases] Can anyone see the syntax error?

> >Date: Tue, 13 Feb 2001 11:57:10 -0500

> >

> >Can anyone see the syntax error here?

> >Error Type:

> >Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)

> >[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing

> >operator) in query expression 'LoyaltyProgramEnddate >= #2/13/2001

> >11:49:22 AM# and where LoyaltyProgramStartDate <= #2/13/2001 11:49:22

> >AM#'.

> >

> >The code is:

> >

> >SQL7 = "Select distinct * from LoyaltyProgram"

> >   'New Line to simulate Partner Services Results

> >   SQL7 = SQL7 & " where LoyaltyProgramEnddate >= #" & Now

> >   SQL7 = SQL7 & "# and where LoyaltyProgramStartDate <= #" & Now

> >   'SQL7 = SQL7 & "# and where datediff('d', LoyaltyProgramStartDate, #"

> >& Today & "#) < 0"

> >   SQL7 = SQL7 & "# Order by LoyaltyProgramStartDate ASC"

> >   Set RS7 = Server.CreateObject("ADODB.RecordSet")

> >   RS7.Open SQL7, DB, 3, 2, 1

> >

> 
Message #5 by Gregory_Griffiths@c... on Wed, 14 Feb 2001 08:57:18 +0000
You can only use the WHERE keyword once in a Query.



> -----Original Message-----

> From: b.greenhouse@u... [mailto:b.greenhouse@u...]

> Sent: 13 February 2001 16:57

> To: asp_databases@p...

> Cc: b.greenhouse@u...

> Subject: [asp_databases] Can anyone see the syntax error?

> 

> 

> Can anyone see the syntax error here?

> Error Type:

> Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)

> [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing

> operator) in query expression 'LoyaltyProgramEnddate >= #2/13/2001

> 11:49:22 AM# and where LoyaltyProgramStartDate <= #2/13/2001 11:49:22

> AM#'.

> 

> The code is:

> 

> SQL7 = "Select distinct * from LoyaltyProgram"

>   'New Line to simulate Partner Services Results

>   SQL7 = SQL7 & " where LoyaltyProgramEnddate >= #" & Now

>   SQL7 = SQL7 & "# and where LoyaltyProgramStartDate <= #" & Now

>   'SQL7 = SQL7 & "# and where datediff('d', 

> LoyaltyProgramStartDate, #"

> & Today & "#) < 0"

>   SQL7 = SQL7 & "# Order by LoyaltyProgramStartDate ASC"

>   Set RS7 = Server.CreateObject("ADODB.RecordSet")

>   RS7.Open SQL7, DB, 3, 2, 1

> 

> 

  Return to Index