Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access_asp thread: Syntax error


Message #1 by santosh bn <santosh_bn1@y...> on Tue, 4 Sep 2001 07:11:08 -0700 (PDT)
whats teh problem in the code below--->



Sql2=" Select * from Activity where Acdate Between #"

& request.form("Var1") & "# and #" &

request.form("Var2") & "# and

Userid='"&request.form("userid")&"' "





teh error is--->

Microsoft OLE DB Provider for ODBC Drivers

(0x80040E14)

[Microsoft][ODBC Microsoft Access Driver] Syntax error

in date in query expression 'Acdate Between

#09/01/2001# and #09/31/2001# and Userid='joshsun''.





the date range is correct but teh query is not

executing in asp but in access DB the same SQL is

executing fine ..Pl help

Message #2 by "Zee Computer Consulting" <zee@t...> on Tue, 4 Sep 2001 12:28:03 -0700
Try getting rid of the BETWEEN -- use >= and <= instead:



    Sql2 = " SELECT * from Activity "

_

            & " WHERE Acdate >= #" & request.form("Var1") & "#"    _

            & " AND AcDate <= #" & request.form("Var2") & "#"        _

            & " AND Userid = '" & request.form("userid") & "' "







-- Zee





----- Original Message -----

From: santosh bn <santosh_bn1@y...>

To: Access ASP <access_asp@p...>

Sent: Tuesday, September 04, 2001 7:11 AM

Subject: [access_asp] Syntax error





> whats teh problem in the code below--->

>

> Sql2=" Select * from Activity where Acdate Between #"

> & request.form("Var1") & "# and #" &

> request.form("Var2") & "# and

> Userid='"&request.form("userid")&"' "

>

>

> teh error is--->

> Microsoft OLE DB Provider for ODBC Drivers

> (0x80040E14)

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

> in date in query expression 'Acdate Between

> #09/01/2001# and #09/31/2001# and Userid='joshsun''.

>

>

> the date range is correct but teh query is not

> executing in asp but in access DB the same SQL is

> executing fine ..Pl help

>





Message #3 by prayag15@h... on Wed, 5 Sep 2001 16:52:41
Well I am getting same error for following query, I think it's problem 

with Date field and Access..where access has problem to work with date 

field.



USqlQry = ""

USqlQry = USqlQry & "UPDATE Reservation SET Date=" & "#" & UpNDate "#"

USqlQry = USqlQry & " Where SBCName=" & "'" & OSBCName & "'"

USqlQry = USqlQry & " AND  Date=" & "#" & ODate & "#"

USqlQry = USqlQry & " AND  StartTime=" & "#" & OSTime & "#"



I am getting error at only ""UPDATE Reservation SET Date=" & "#" & 

UpNDate "#" here, if i remove that sentence it works fine! any suggestions 

or idea that works.



> teh error is--->

> Microsoft OLE DB Provider for ODBC Drivers

> (0x80040E14)

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

> in date in query expression 'Acdate Between

> #09/01/2001# and #09/31/2001# and Userid='joshsun''.

> 

> 

> the date range is correct but teh query is not

> executing in asp but in access DB the same SQL is

> executing fine ..Pl help

Message #4 by prayag15@h... on Wed, 5 Sep 2001 19:04:22
Santosh, I have found the solution to the problem. Just put the table name 

and dot in front of the field name..Ie. do following



> whats teh problem in the code below--->

> 

> Sql2=" Select * from Activity where Activity.Acdate Between #"

> & request.form("Var1") & "# and #" &

> request.form("Var2") & "# and

> Activity.Userid='"&request.form("userid")&"' "

> 

> 

> teh error is--->

> Microsoft OLE DB Provider for ODBC Drivers

> (0x80040E14)

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

> in date in query expression 'Acdate Between

> #09/01/2001# and #09/31/2001# and Userid='joshsun''.

> 

> 

> the date range is correct but teh query is not

> executing in asp but in access DB the same SQL is

> executing fine ..Pl help


  Return to Index