• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 911
  • Last Modified:

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.

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

Open in new window


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

Open in new window


Any help is greatly appreciated!
0
ITDeptAtPCS
Asked:
ITDeptAtPCS
  • 2
1 Solution
 
cyberkiwiCommented:
force.query("SELECT Id, Name, Plan_ID__c FROM Opportunity WHERE Id = '"  + :planId + "'", new AsyncResponder(querySuccess));
0
 
ITDeptAtPCSAuthor Commented:
Thanks for the quick response.  With that I received:

1084: Syntax error: expecting identifier before colon.      Main.mxml      1st Flex/src      line 34      Flex Problem
0
 
ITDeptAtPCSAuthor Commented:
I removed the colon and was good to go.

Thanks!
0

Featured Post

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now