Question : Flex SQL query with variable in WHERE

Hi all,
I'm new to Flex and am having difficulty in creating a dynamic SQL query.  Basically I have a text input box allowing the user to enter an ID to be used as the where criteria in my SQL string.

1:
2:
3:
4:
5:
public function doSearch(planId:String=""):void
{
force.query("SELECT Id, Name, Plan_ID__c FROM Opportunity WHERE Id = "  + :planId, new AsyncResponder(querySuccess));
}


If I replace the string with the following it works fine, but I'm just not sure how to make it dynamic:
1:
2:
force.query("SELECT Id, Name, Plan_ID__c FROM Opportunity WHERE Id = '0066000000AKCam'", new AsyncResponder(querySuccess));


Any help is greatly appreciated!

Answer : Flex SQL query with variable in WHERE

force.query("SELECT Id, Name, Plan_ID__c FROM Opportunity WHERE Id = '"  + :planId + "'", new AsyncResponder(querySuccess));
Random Solutions  
 
programming4us programming4us