You need to sign in to do that
Don't have an account?
Rick Culbreth
parameter variable not recognized on select statement when working Trailhead for Map .NET Concepts to Force.com
I'm admin begging to work on some development. I'm going through the trailhead module for map .net concepts to force.com. The exersize was totally different concept than that was covered in the module. Anyway I'm supposed to build class that has a method that accepts state abreviation and returns a list of accounts that BillingState matches that state. For some reason I get an invalid token when I use the parameter variable or if I assign the parameter variable value to another string variable in the method. I can hard code a state and it will compile. Not sure what I'm missing.
public with sharing class AccountUtils {
// Public method
public static List <Account> accountsByState(String Stateab) {
// Return a list of accounts by state
String st = Stateab;
return [SELECT Id, Name
FROM Account where (BillingState = Stateab)];
}
}
Problems show
AccountUtils Line 7 Unexpect token 'Stateab'
AccountUtils Line 6 expecting a colon, found 'Stateab'
public with sharing class AccountUtils {
// Public method
public static List <Account> accountsByState(String Stateab) {
// Return a list of accounts by state
String st = Stateab;
return [SELECT Id, Name
FROM Account where (BillingState = Stateab)];
}
}
Problems show
AccountUtils Line 7 Unexpect token 'Stateab'
AccountUtils Line 6 expecting a colon, found 'Stateab'
All Answers
Please do choose a best answer so as to close this question.