469,922 Members | 2,106 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,922 developers. It's quick & easy.

Line 1: Incorrect syntax near '<'.

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);

Dec 22 '06 #1
1 2137
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
---------------
query2 += query.substring(0, 386) + "'crop protection'";
var tempData = executeRS(query);

iporter wrote:
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);
Dec 22 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Roger R. Smith | last post: by
1 post views Thread by Sandesh | last post: by
6 posts views Thread by martin1 | last post: by
5 posts views Thread by =?Utf-8?B?QW5kcmV3?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.