且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在将新行插入数据表时添加计数器值

更新时间:2023-11-30 20:35:40

请点击此链接:创建自动增量列 [ ^ ]
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.