• Venkateshwarrao Admin
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 1
    Replies

While savethepage I am getting error for "System.QueryException: List has no rows for assignment to SObject"
Code:
<apex:page controller="Mycontroller" tabStyle="Account">
<apex:form >
 <apex:pageBlock title="AccountDetails">
  <apex:pageBlockSection title="Accountinformation">
    <apex:inputField value="{!Account.Name}"/>
    <apex:inputField value="{!Account.Phone}"/>
    <apex:inputField value="{!Account.Fax}"/>
    <apex:inputField value="{!Account.ShippingCity}"/>
 </apex:pageBlockSection>
 <apex:pageBlockSection title="Account Detail">
   <apex:inputField value="{!Account.Annualrevenue}"/>
   <apex:inputField value="{!Account.Website}"/>
 </apex:pageBlockSection>
   <apex:pageBlockButtons >
   <apex:commandButton action="{!Save}" value="SavethePage"/>
  </apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:page>

Class:
public with sharing class Mycontroller 
{
  Public Account acc;
  Public Mycontroller()
  {
  try{
     acc=[SELECT Id,Name,Phone,Fax,ShippingCity,Website,AnnualRevenue from account Where Id=:ApexPages.CurrentPage().getparameters().get('Id')];
         } 
    catch (Exception e) {
    acc= new Account();
       }  
  }
  public Account getaccount()
  {
  return acc;
  }
  Public Pagereference Save()
  {
  
    Update acc;
    Pagereference page=New ApexPages.standardController(acc).View();
    return page;
   }
}


Please any one provide me the solution. and tell me steps i have to follow
Hai,
Q) i have two standard objects Account and Contact,Requirment is Display the  Count of Contact on account obj by using custom field Count_of_con. trigger have write. anyone send the code.advanced thanks
 
Hello,
Any one can send the realtime Scenario fo vf pages? or Send the suggesting sites for practice?
i will wait for reply.
Hai .
Q:how to display the Account list in vf page?when it displays the Account list if we click on particular account it should be display the contacts of that account.how?can any one explain with code?
Hai,
Q) i have two standard objects Account and Contact,Requirment is Display the  Count of Contact on account obj by using custom field Count_of_con. trigger have write. anyone send the code.advanced thanks