You need to sign in to do that
Don't have an account?
Update query in SOQL
Hi,
I'm new to salesforce, APEX and SOQL. I want to know, how can we update some record using SOQL in APEX code?
You need to sign in to do that
Don't have an account?
Hi,
I'm new to salesforce, APEX and SOQL. I want to know, how can we update some record using SOQL in APEX code?
You can't update records using SOQL - it is a query only language.
You would update record using Data Manipulation Language (DML). E.g. to query a record and then update it you could use the following snippet:
More information on DML is available in the Apex Developer's Guide at:
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_dml.htm?SearchType=Stem&Highlight=DML|dml
All Answers
You can't update records using SOQL - it is a query only language.
You would update record using Data Manipulation Language (DML). E.g. to query a record and then update it you could use the following snippet:
More information on DML is available in the Apex Developer's Guide at:
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_dml.htm?SearchType=Stem&Highlight=DML|dml
Thanx.... Even this query help me too
Can anyone tell me what's wrong?, I get this when I do that...
System.LimitException: pato:DML currently not allowed
Class.pato.ListOpportunities.getMyObjectOpportunities: line 354, column 1
The line 354 is where I have "update opp"
thank you.
You can't execute DML in the Constructor (or call a method that executes DML from a Constructor)
If this is the controller for a VF page, you can use the action parameter on the page to directly execute addcomment, and that is allowed I believe.