Solved

Flex SQL query with variable in WHERE

Posted on 2010-08-19
3
877 Views
Last Modified: 2013-11-16
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
Comment
Question by:ITDeptAtPCS
  • 2
3 Comments
 
LVL 58

Accepted Solution

by:
cyberkiwi earned 500 total points
ID: 33480810
force.query("SELECT Id, Name, Plan_ID__c FROM Opportunity WHERE Id = '"  + :planId + "'", new AsyncResponder(querySuccess));
0
 
LVL 1

Author Comment

by:ITDeptAtPCS
ID: 33480829
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
 
LVL 1

Author Comment

by:ITDeptAtPCS
ID: 33480841
I removed the colon and was good to go.

Thanks!
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Get to know the ins and outs of building a web-based ERP system for your enterprise. Development timeline, technology, and costs outlined.
For cloud, the “train has left the station” and in the Microsoft ERP & CRM world, that means the next generation of enterprise software from Microsoft is here: Dynamics 365 is Microsoft’s new integrated business solution that unifies CRM and ERP fun…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now