How to embed a string inside a SOQL query string?

8:57 PM

Below is the syntax to do this.. Note that you have a string inside a string and the syntax to do so, the backslash followed by the single quote is the syntax.
public with sharing class forcetree 
{
 String squery = 'Select Id from User where Name=\'forcetree\'';
 Database.query(squery);
}

0 comments