I have the following string which won’t compile:
String formLookupPull = @'SELECT value1, ''+tableName+'', ''+columnName+'' FROM lkpLookups WHERE ''table'' = '' + tableName + '' and ''field'' = '' + columnName + '';';
The offending sections are :
''table'' =
and
''field'' =
The compiler is getting all mixed up on the escape sequence. Can anyone see what’s wrong?
The problem is that not all the strings you are concatenating are verbatim string literals, only the first portion of the concatenation is.
In other words,
is the only verbatim literal in the entire statement to build the final string.
You would need to add @ in front of the rest of your strings to make them all verbatim.
Which would make it look like: