Solved

Flex SQL query with variable in WHERE

Posted on 2010-08-19
3
880 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating and Managing Databases with phpMyAdmin in cPanel.
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…

896 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

16 Experts available now in Live!

Get 1:1 Help Now