You need to sign in to do that
Don't have an account?
Deepu2123
Error on my visualforce page
Hi
Can Anybody please explain the issue, please
List has no rows for assignment to SObject this error is showing when I am clicking on the preview.
Apex class:
public class mycontroller{.
public string getname() {
return 'saicharan';
}
public Account getaccount() {
return [select id, name from account
where id = :ApexPages.currentPage().getParameters().get('id')];
}
}
Visualforce page:
<apex:page controller="mycontroller">
<apex:pageBlock title="Hello World {!$User.FirstName}!"> This is my New Page for the {!name} my controller. <br/>
You are viewing the {!account.name} account.
</apex:pageBlock>
</apex:page>
Can Anybody please explain the issue, please
List has no rows for assignment to SObject this error is showing when I am clicking on the preview.
Apex class:
public class mycontroller{.
public string getname() {
return 'saicharan';
}
public Account getaccount() {
return [select id, name from account
where id = :ApexPages.currentPage().getParameters().get('id')];
}
}
Visualforce page:
<apex:page controller="mycontroller">
<apex:pageBlock title="Hello World {!$User.FirstName}!"> This is my New Page for the {!name} my controller. <br/>
You are viewing the {!account.name} account.
</apex:pageBlock>
</apex:page>
Your code is correct but the preview cannot work because you have to put the id in the URL:
http://xxxx.visual.force.com/apex/myVFPpage?id=0010Y000009SvCy
Just view an existing account and add: /apex/myVFPpage?id= in the URL just before the ID.
Regard