How to Insert Flat Data into CustomList In SharePoint 2010

In this article we will discuss how to insert flat data into custom list in sharepoint 2010. Flat data means suppose the data is in notepad like below:

1 IT 10
2 Gov 20

Also you can see some SharePoint 2010 object model articles and List and Library articles here.

SPWeb web = new SPSite(“http://demo:500/”).OpenWeb();

SPList empList = web.Lists[“Dept”];

SPListItem item;

StreamReader sr = new StreamReader(“C:\\a.txt”);

while (sr.Peek() != -1)

string record = sr.ReadLine();

string[] data=record.Split(‘ ‘);







In Notepad:
1 IT 10
2 Gov 20

Check out Best Alternative to InfoPath -> Try Now

You May Also like the Following SharePoint Online Tutorials: