Click here to Skip to main content
15,884,047 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
DataTable DTRows;
int x=0;
DTRows.Rows.Add(x);

here x is counter... its value should increament after adding new row into DTRows
Posted

Follow this link: Creating AutoIncrement Columns[^]
 
Share this answer
 
Try:
C#
DataTable DTRows = new DataTable();
int x=0;
DTRows.Rows.Add(x++);
The Add method of a DataRowCollection adds an object, not a number of rows.
 
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