PDA

View Full Version : Problem trying to concatenate a complex SQL statement into a SQL text variable in ASP


[TvR] -=CyRuS=-
12-01-2001, 13:12
Hi, I have a small problem trying to concatenate a Complex SQL statement into a SQL text variable, I have ten statements which all throw up the same error message.

(i commented them out and tested individually)

This is from page 129 of Beggining ASP Databases.

Below is one of the statements, they are all similar and the error is in exactly the same place + The error message from Internet Explorer.

Thanks in Advance,

Marcus Miller


Error Detaisl

Code

dim sqlChoice2 'choice 2 for use in query
sqlChoice2="SELECT [Car Rental Companies].[Company Name], [Car Rental Companies].[Address(Road)], "
sqlChoice2=sqlChoice2 & "[Car Rental Companies].[Address 1(Area)], [Car Rental Companies].[Address 2(City)], "
sqlChoice2=sqlChoice2 & "[Car Rental Companies].[Address 3], [Car Rental Companies].[Post Code], "
sqlChoice2=sqlChoice2 & "[Car Rental Companies].Telephone, [Car Rental Companies].[Mobile Phone], "
sqlChoice2=sqlChoice2 & "[Car Rental Companies].[Email No], [Car Rental Companies].[Web Site], "
sqlChoice2=sqlChoice2 & "[Car Rental Companies].[On Line Booking], [Car Rental Companies].[Opening days], "
sqlChoice2=sqlChoice2 & "[Car Rental Companies].[Opening Hours], [Car Rental Companies].CHEQUE, "
sqlChoice2=sqlChoice2 & "[Car Rental Companies].[CREDIT CARD], [Car Rental Companies].[Deposite Reqd], "
sqlChoice2=sqlChoice2 & "[Car Rental Companies].[Maximum Age], [Car Rental Companies].[Del & Collect], "
sqlChoice2=sqlChoice2 & "[Car Rental Companies].Cost, [Car Rental Companies].[Motoring Convictions], "
sqlChoice2=sqlChoice2 & "[Car Rental Companies].Criteria, [Car Rental Companies].[One way rentals], "
sqlChoice2=sqlChoice2 & "[Car Rental Companies].Amount, [Car Rental Companies].[Mileage charge], "
sqlChoice2=sqlChoice2 & "[Car Rental Companies].[Automatics available], [Car Rental Companies].[Deisels available], "
sqlChoice2=sqlChoice2 & "[Car Rental Companies].AA, [Car Rental Companies].RAC, [Car Rental Companies].[GREEN fLAG], "
sqlChoice2=sqlChoice2 & "[Car Rental Companies].Other"
sqlChoice2=sqlChoice2 & " FROM [Car Rental Companies]"
sqlChoice2=sqlChoice2 & " WHERE ((([Car Rental Companies].CASH)="yes") AND "
sqlChoice2=sqlChoice2 & "(([Car Rental Companies].[Under 25])="yes") AND "
sqlChoice2=sqlChoice2 & "(([Car Rental Companies].[Del & Collect])="yes"));"



Error Message from i.e5


Error Type:
Microsoft VBScript compilation (0x800A0401)
Expected end of statement
/BEGASP/htdoutput.asp, line 75, column 65
sqlChoice2=sqlChoice2 & " WHERE ((([Car Rental Companies].CASH)="yes") AND "
----------------------------------------------------------------^


Any ideas peeps, i have tried moving bits around all to no avail, (he says desperately) :bigcry:

Thanks in advance for any help

[TvR] -=CyRuS=-
12-01-2001, 16:42
fixed it peeps, so dont waste ya time. :)

had to replace the " round the "yes" word towards end of syntax with '. or seperate the expression.

ie

"(([Car Rental Companies].[Under 25])=" & "yes" & ") AND "

progin eh... dont ya just love it :pimp: NOT...