PDA

View Full Version : Probably somethign really simple


piaffe
06-13-2005, 02:44 PM
I've been staring at this bit of code for well over an hour now and cant figure out what's wrong:

<%strConnect = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source="& _
Server.MapPath("..\private\db2.mdb")
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.open strConnect
Set objRS = Server.CreateObject("ADODB.RecordSet")
objRS.open "SELECT Business_Name, Address1, Address2, Town, City, County, Postcode, Postcode_2, Phone, Website_Address, Picture_Location FROM Sheet1 WHERE Take_Away = '"&Request.form("Take_Away")&"' AND City = '"&Request.form("City")&"'" ,objConn
Do While NOT objRS.EOF
Response.Write "<table><tr><td width=110><img src="& objRS("Picture_Location") & " width=100 height=100></td><td><b>"& objRS("Business_Name") & "</b><br>"& objRS("Address1") & ""& objRS("Address2") & "<br>"& objRS("Town") & "<br>"& objRS("City") & "<br>"& objRS("County") & "<br>"& objRS("Postcode") & " "& objRS("Postcode2") & "<br><a href="& objRS("Website_Address") & " target=_blank>"& objRS("Website_Address") & "</a><br><a href="& objRS("Picture_Location") & " target=_blank">Click For Menu</a></td></tr></table><hr>"
objRS.MoveNext '** goto the next record**
Loop

'*** clean up ***
objRS.close : objConn.close
%>

I get an error "Microsoft VBScript compilation error '800a0401'

Expected end of statement

/results.asp, line 188 "

This is the bit following the Response.Write


Any idea what im missing and from whereabouts?

Thanks

Laura

Brandoe85
06-13-2005, 03:04 PM
I think you missed an ampersand towards the end of your response.write:

Response.Write "<table><tr><td width=110><img src="& objRS("Picture_Location") & " width=100 height=100></td><td><b>"& objRS("Business_Name") & "</b><br>"& objRS("Address1") & ""& objRS("Address2") & "<br>"& objRS("Town") & "<br>"& objRS("City") & "<br>"& objRS("County") & "<br>"& objRS("Postcode") & " "& objRS("Postcode2") & "<br><a href="& objRS("Website_Address") & " target=_blank>"& objRS("Website_Address") & "</a><br><a href="& objRS("Picture_Location") & " target=_blank" &" >Click For Menu</a></td></tr></table><hr>"

miranda
06-13-2005, 04:42 PM
Any time you want to display double quotes inside a response write you need to use two of them to tell the asp parser that you are displaying one. Otherwise the parser thinks you are ending the string you are displaying.

Response.Write "<table><tr><td width=110><img src="& objRS("Picture_Location") & " width=100 height=100></td><td><b>"& objRS("Business_Name") & "</b><br>"& objRS("Address1") & ""& objRS("Address2") & "<br>"& objRS("Town") & "<br>"& objRS("City") & "<br>"& objRS("County") & "<br>"& objRS("Postcode") & " "& objRS("Postcode2") & "<br><a href="""& objRS("Website_Address") & """ target=_blank>"& objRS("Website_Address") & "</a><br><a href="""& objRS("Picture_Location") & """ target=_blank>Click For Menu</a></td></tr></table><hr>"

ps why did you use such a long response.write instead of breaking it up into sections?

hughesmi
06-16-2005, 11:12 PM
Not that this may help anyone. But I struggle with quotes too. So what I tend to do use this software called EasyEdi. It shows if the the asp line is good or not. Then if I canny get it to work, I post for help.

Dowload and try it,
http://www.easyasp.org/