Line 1: Incorrect syntax near '<'.

I

iporter

In the following code, the two Response.Write statements output exactly
the same - I can copy and paste both into Query Analyzer, and run them
fine. However, if I comment out line 3, the assignment of "SELECT
T..." to the variable query, the last line produces the error:

Line 1: Incorrect syntax near '<'.

Many thanks in advance for any explanation - the problem is tearing my
hair out!!
Iain

CODE:
---------------
var query = unprocessedRuleHTML.substring(ruleIndex.length,
(unprocessedRuleHTML.length - "</DIV>".length));

Response.Write("**" + query + "**<br /><br />");

query = "SELECT TOP 5 CI_MI.CI_ID, MI_ID, MI.url, CI.content, title,
AccessibilityTitle, MI.LongTitle, extension FROM ContentItems CI LEFT
JOIN CI_MI ON CI_MI.CI_ID = CI.ID LEFT JOIN MenuItems MI ON CI_MI.MI_ID
= MI.ID LEFT JOIN CF_CI ON CI.ID = CF_CI.CI_ID LEFT JOIN ContentFormats
CF ON CF_CI.CF_ID = CF.ID LEFT JOIN CI_T ON CI.ID = CI_T.CI_ID LEFT
JOIN Tags T ON CI_T.T_ID = T.ID WHERE tag = 'crop protection'";

Response.Write("**" + query + "**<br /><br />");

var tempData = executeRS(query);
 
I

iporter

Followup - I thin it's something to do with having the single quote
marks in the string. If I replace just the last part of the string,
the 'crop protection' (including single quote marks), then it works
(see code below).

I tried storing these as escaped (thus \'crop protection\'), but it
gave me the error message: Line 1: Incorrect syntax near '\'.

Thanks again,
Iain

CODE
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,989
Messages
2,570,207
Members
46,783
Latest member
RickeyDort

Latest Threads

Top