...

View Full Version : little error in code 'Expected end of statement'



startbar
07-17-2004, 06:16 PM
hi this code:

dim ordervariable, sortorder
ordervariable = "Category" 'default column to sort on
sortorder = "ASC" 'default sortorder

if (len(request.querystring("sortby")) >= 1) then
ordervariable = request.querystring("sortby")
end if
if (len(request.querystring("sortorder")) >= 1) then
sortorder = request.querystring("sortorder")
end if

strSQL = "SELECT Name, Category, County, Town, ID " _
& "FROM NETWORK " _
& "WHERE Status=1 LIKE '%" & Replace(strSearch, "'", "''") & "%' " _
& "OR Name LIKE '%" & Replace(strSearch, "'", "''") & "%' " _
& "OR Category LIKE '%" & Replace(strSearch, "'", "''") & "%' " _
& "ORDER BY & ordervariable & " " & sortorder " _

gives me this error

Microsoft VBScript compilation error '800a0401'

Expected end of statement

/business/network.asp, line 137

& "ORDER BY & ordervariable & " " & sortorder " _
--------------------------------^

any ideas?

thanks

M@rco
07-18-2004, 02:04 PM
Wrong:
& "ORDER BY & ordervariable & " " & sortorder " _Right:
& "ORDER BY " & ordervariable & " " & sortorder " _;)

startbar
07-18-2004, 02:42 PM
thanks! :)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum