function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ManjusrinuManjusrinu 

inserting records by using list

Hi,
I need to insert a record into account object by using lists.
I tried the following code but it is not working 
Can anyone help me to solve out the problem ?

Apex-class:
public class Listaccounts 
{
  public static  void accounts()
   {
    List<Account> myList = new List<Account>(); 
    Account a = new Account(Name='ramana'); 
    myList.add(a);                    
    }
}

Vf-page:
<apex:page Controller=" Listaccounts ">
</apex:page>
ShirishaShirisha (Salesforce Developers) 
Hi Dinesh,

Greetings!

You need to define the inputFied on the Visualforce page to enter the value by the user.Please find the sample code in the below thread:

https://developer.salesforce.com/forums/?id=906F000000094u8IAA

Kindly mark it as best answer if it helps so that it can help others in the future.

Warm Regards,
Shirisha Pathuri
ManjusrinuManjusrinu
Actually i have given the value in my class itself as ramana the same value should be get displayed when the vf page is executed