// Open your SPSite
using(SPSite oSite = new SPSite("http://ils-jacobr:35526")) {
//Get a Root Web
using(SPWeb oWeb = oSite.RootWeb) {
//Get a Particular List
SPList oList = oWeb.Lists["EmployeeDetails"];
//Add a New item
SPListItem oSPListItem = oList.Items.Add();
oSPListItem["Employee ID"] = txtEmployeeId.Text;
oSPListItem["City"] = txtCity.Text;
oSPListItem["State"] = txtState.Text;
oSPListItem["First Name"] = txtFirstName.Text;
oSPListItem["Last Name"] = txtLastName.Text;
oSPListItem.Update();
}
}Here I have explained how to add a new item in SharePoint list using C# code.
