C#操作MongoDB实现自增列怎么写
1个回答
2017-02-13 · 知道合伙人互联网行家
关注
展开全部
System.Data.DataTable table = new DataTable();
System.Data.DataColumn column = new DataColumn();
column.ColumnName = "序号";
column.AutoIncrement = true;
column.AutoIncrementSeed = 1;
column.AutoIncrementStep = 1;
table.Columns.Add(column);
table.Merge(ds.Tables[0]);
datagridview1.DataSource = table;
datagridview1.Columns["序号"].DisplayIndex = 0;//调整列顺序
System.Data.DataColumn column = new DataColumn();
column.ColumnName = "序号";
column.AutoIncrement = true;
column.AutoIncrementSeed = 1;
column.AutoIncrementStep = 1;
table.Columns.Add(column);
table.Merge(ds.Tables[0]);
datagridview1.DataSource = table;
datagridview1.Columns["序号"].DisplayIndex = 0;//调整列顺序
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询