using System.Data; DataTable myTable = new DataTable(); myTable.BeginLoadData(); // Perform bulk data modifications myTable.EndLoadData();
using System.Data; DataTable myTable = new DataTable(); myTable.BeginLoadData(); while (reader.Read()) { DataRow row = myTable.NewRow(); row["ID"] = reader.GetInt32(0); row["Name"] = reader.GetString(1); myTable.Rows.Add(row); } myTable.EndLoadData();In this example, we use a SqlDataReader to populate our DataTable with data from a database. We call BeginLoadData before our loop to indicate that we will be performing bulk data modifications. Then, inside the loop, we create a new DataRow for each record and add it to the DataTable. Finally, we call EndLoadData to notify any data-bound controls that we have completed making changes. Package Library: The BeginLoadData method is part of the System.Data.dll assembly, which is part of the .NET Framework Class Library.