Click here to Skip to main content
15,891,033 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I adding new row in datatable by c#, but it slows down the application performance, please suggest which is fastest way to add new row in datatable without compromising performance.

Thanks in Advance.

What I have tried:

I tried
List newRow = new List();
//code to add values in list
newRow.Add('10001');
datatable.Rows.Add(newRow.ToArray());

also tried
DataRow newRow = datatable.NewRow();
newRow[0] = '10001';
datatable.Rows.Add(newRow);
Posted
Updated 17-Jul-18 16:44pm

1 solution

If you insert many rows, wrap it into database transaction.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900