//实现功能 DataGridView 添加 自动编号 DataTable table = DataTable(); DataColumn column = DataColumn(); Column.AutoIncrement = true; //AutoIncrement 获取或设置一个值,该值指示对于添加到该表中的新行,列是否将列的值自动递增 column.ColumnName = "自动编号"; column.AutoIncrementSeed = 1; column.AutoIncrementStep = 1; table.Colnmns.Add(column); table.Merge(BindDataGridView().Table[0]);//Merge合并DataTable this.datagridview.DataSource = table;