Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access thread: Expected end of statement


Message #1 by "fareed parhad" <fareed_parhad@e...> on Tue, 13 Nov 2001 12:22:37
I've been trying to cut and paste an SQL statement directly from access 

into my ASP only to receive the following error:



Microsoft VBScript compilation error '800a0401' 



Expected end of statement 



/listingstest/listcont.asp, line 18 



SQLQuery =SQLQuery &"WHERE (((listings.genre)="club"));"

-----------------------------------------------^



HELP!





Message #2 by Dave Sharpe <pmmgpgp@y...> on Tue, 13 Nov 2001 09:22:00 -0800 (PST)
Fareed-



I don't feel that you are looking at enough info.



Despite the fact that you are being told

"line 18" is the problem, we need to look 

at all of the lines prior to 18 that "build" 

the string SQLQuery.



Dave







--- fareed parhad <fareed_parhad@e...> wrote:

> I've been trying to cut and paste an SQL statement

> directly from access 

> into my ASP only to receive the following error:

> Microsoft VBScript compilation error '800a0401' 

> Expected end of statement 

> /listingstest/listcont.asp, line 18 

> SQLQuery =SQLQuery &"WHERE

> (((listings.genre)="club"));"

> -----------------------------------------------^

> HELP!

> 





__________________________________________________

Do You Yahoo!?

Find the one for you at Yahoo! Personals

http://personals.yahoo.com

Message #3 by fareed_parhad@e... on Tue, 13 Nov 2001 11:20:16 -0800 (PST)
Thanx Dave,



I actually seem to have remedied the problem for now- but I'm not entirely

sure how! It seems to have had something to do with nesting single inverted

comma's within double inverted comma's. Whereas previously my code read:



<%@ LANGUAGE="VBScript"%>



<%

Option Explicit



Dim Conn, dbPath 

Dim RS

Dim SQLQuery

Dim theday,sufx,themonth,theyear



dbPath 

"D:\webspace\wwwserver1\overall-online\overall-online.co.uk\www\listings.mdb"



Set Conn = Server.CreateObject("ADODB.Connection") 

Conn.Open "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=" & dbPath



SQLQuery = "SELECT listings.calendardate, listings.gigdate,

listings.description, listings.act, listings.venue, listings.time,

listings.entryfee FROM listings WHERE (((listings.genre)="club"));"



Wherreas now it reads:



...WHERE (((listings.genre)='club'));"



Excuse me for my newbie-ness but could you explain why this is so?



On Tue, 13 Nov 2001 09:22:00 -0800 (PST), Access wrote:



>  Fareed-

>  

>  I don't feel that you are looking at enough info.

>  

>  Despite the fact that you are being told

>  "line 18" is the problem, we need to look 

>  at all of the lines prior to 18 that "build" 

>  the string SQLQuery.

>  

>  Dave

>  

>  

>  

>  --- fareed parhad <fareed_parhad@e...> wrote:

>  > I've been trying to cut and paste an SQL statement

>  > directly from access 

>  > into my ASP only to receive the following error:

>  > Microsoft VBScript compilation error '800a0401' 

>  > Expected end of statement 

>  > /listingstest/listcont.asp, line 18 

>  > SQLQuery =SQLQuery &"WHERE

>  > (((listings.genre)="club"));"

>  > -----------------------------------------------^

>  > HELP!

>  > 

>  

>  

>  __________________________________________________

>  Do You Yahoo!?

>  Find the one for you at Yahoo! Personals

>  http://personals.yahoo.com

>  




>











_______________________________________________________

 Get 100% private, FREE email for life from Excite UK

 Visit http://inbox.excite.co.uk/ 



Message #4 by "dave sharpe" <pmmgpgp@y...> on Tue, 13 Nov 2001 18:41:42 -0500
Fareed-



Regarding your question:

"Excuse me for my newbie-ness but could you explain why this is so?"



I understand your question, but I'm not equipped to discuss it;

 it is a much bigger question [ punctuaion marks in queries ] than

you imagine. Please see the following info from MicroSoft.



HOWTO: Query for Literal Special Characters in a Where Clause



http://support.microsoft.com/support/kb/articles/Q147/6/87.ASP



Dave



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

From: <fareed_parhad@e...>

To: "Access" <access@p...>

Sent: Tuesday, November 13, 2001 2:20 PM

Subject: [access] Re: Expected end of statement





Thanx Dave,



I actually seem to have remedied the problem for now- but I'm not entirely

sure how! It seems to have had something to do with nesting single inverted

comma's within double inverted comma's. Whereas previously my code read:



<%@ LANGUAGE="VBScript"%>



<%

Option Explicit



Dim Conn, dbPath

Dim RS

Dim SQLQuery

Dim theday,sufx,themonth,theyear



dbPath 

"D:\webspace\wwwserver1\overall-online\overall-online.co.uk\www\listings.mdb

"



Set Conn = Server.CreateObject("ADODB.Connection")

Conn.Open "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=" & dbPath



SQLQuery = "SELECT listings.calendardate, listings.gigdate,

listings.description, listings.act, listings.venue, listings.time,

listings.entryfee FROM listings WHERE (((listings.genre)="club"));"



Wherreas now it reads:



...WHERE (((listings.genre)='club'));"



Excuse me for my newbie-ness but could you explain why this is so?



On Tue, 13 Nov 2001 09:22:00 -0800 (PST), Access wrote:



>  Fareed-

>

>  I don't feel that you are looking at enough info.

>

>  Despite the fact that you are being told

>  "line 18" is the problem, we need to look

>  at all of the lines prior to 18 that "build"

>  the string SQLQuery.

>

>  Dave

>

>

>

>  --- fareed parhad <fareed_parhad@e...> wrote:

>  > I've been trying to cut and paste an SQL statement

>  > directly from access

>  > into my ASP only to receive the following error:

>  > Microsoft VBScript compilation error '800a0401'

>  > Expected end of statement

>  > /listingstest/listcont.asp, line 18

>  > SQLQuery =SQLQuery &"WHERE

>  > (((listings.genre)="club"));"

>  > -----------------------------------------------^

>  > HELP!

>  >

>

>

>  __________________________________________________

>  Do You Yahoo!?

>  Find the one for you at Yahoo! Personals

>  http://personals.yahoo.com

>




>











_______________________________________________________

 Get 100% private, FREE email for life from Excite UK

 Visit http://inbox.excite.co.uk/
















_________________________________________________________



Do You Yahoo!?



Get your free @yahoo.com address at http://mail.yahoo.com







Message #5 by "Ian Ashton" <ian@c...> on Wed, 14 Nov 2001 06:48:41 -0000
Fareed,



The overall question of Punctuation marks in queries has many little "stings

in its tail" (such as a name like "O'Connell) and it is probably better to

follow Dave's suggestion view see the info from Microsoft.



However, if you will bear with the verbiage, we can analyse your particular

SQL statement to see what this specific problem is:



"SELECT ............... FROM listings WHERE (((listings.genre)="club"));"



the system sees the double quote mark after the equals sign as the delimiter

at the END of the string:



i.e.

the compiler is being asked to compile:



"SELECT ............... FROM listings WHERE (((listings.genre)="

as a COMPLETED statement (which has an illegal format), followed by another

set of characters:

club"));"



which, as far as the compiler is concerned, belong nowhere.



On the other hand "SELECT ............... FROM listings WHERE

(((listings.genre)='club'));"



is seen as a single complete statement between the pair of double quote

marks. This is a legal statement as SQL accepts single quotes to define a

string value ('club').



I hope this helps



Ian Ashton





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

From: dave sharpe [mailto:pmmgpgp@y...]

Sent: Tuesday, November 13, 2001 11:42 PM

To: Access

Subject: [access] Re: Expected end of statement





Fareed-



Regarding your question:

"Excuse me for my newbie-ness but could you explain why this is so?"



I understand your question, but I'm not equipped to discuss it;

 it is a much bigger question [ punctuaion marks in queries ] than

you imagine. Please see the following info from MicroSoft.



HOWTO: Query for Literal Special Characters in a Where Clause



http://support.microsoft.com/support/kb/articles/Q147/6/87.ASP



Dave



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

From: <fareed_parhad@e...>

To: "Access" <access@p...>

Sent: Tuesday, November 13, 2001 2:20 PM

Subject: [access] Re: Expected end of statement





Thanx Dave,



I actually seem to have remedied the problem for now- but I'm not entirely

sure how! It seems to have had something to do with nesting single inverted

comma's within double inverted comma's. Whereas previously my code read:



<%@ LANGUAGE="VBScript"%>



<%

Option Explicit



Dim Conn, dbPath

Dim RS

Dim SQLQuery

Dim theday,sufx,themonth,theyear



dbPath 

"D:\webspace\wwwserver1\overall-online\overall-online.co.uk\www\listings.mdb

"



Set Conn = Server.CreateObject("ADODB.Connection")

Conn.Open "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=" & dbPath



SQLQuery = "SELECT listings.calendardate, listings.gigdate,

listings.description, listings.act, listings.venue, listings.time,

listings.entryfee FROM listings WHERE (((listings.genre)="club"));"



Wherreas now it reads:



...WHERE (((listings.genre)='club'));"



Excuse me for my newbie-ness but could you explain why this is so?



On Tue, 13 Nov 2001 09:22:00 -0800 (PST), Access wrote:



>  Fareed-

>

>  I don't feel that you are looking at enough info.

>

>  Despite the fact that you are being told

>  "line 18" is the problem, we need to look

>  at all of the lines prior to 18 that "build"

>  the string SQLQuery.

>

>  Dave

>

>

>

>  --- fareed parhad <fareed_parhad@e...> wrote:

>  > I've been trying to cut and paste an SQL statement

>  > directly from access

>  > into my ASP only to receive the following error:

>  > Microsoft VBScript compilation error '800a0401'

>  > Expected end of statement

>  > /listingstest/listcont.asp, line 18

>  > SQLQuery =SQLQuery &"WHERE

>  > (((listings.genre)="club"));"

>  > -----------------------------------------------^

>  > HELP!

>  >

>

>

>  __________________________________________________

>  Do You Yahoo!?

>  Find the one for you at Yahoo! Personals

>  http://personals.yahoo.com

>




>











_______________________________________________________

 Get 100% private, FREE email for life from Excite UK

 Visit http://inbox.excite.co.uk/
















_________________________________________________________



Do You Yahoo!?



Get your free @yahoo.com address at http://mail.yahoo.com















  Return to Index