请点击此链接:创建自动增量列 [ ^ ]
Follow this link: Creating AutoIncrement Columns[^]
尝试:
Try:
DataTable DTRows = new DataTable();
int x=0;
DTRows.Rows.Add(x++);
DataRowCollection的Add方法添加一个对象,而不是多行。
The Add method of a DataRowCollection adds an object, not a number of rows.