如何添加标识列用c#的DataTable [英] How to add identity column to datatable using c#
本文介绍了如何添加标识列用c#的DataTable的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何添加标识列用c#的DataTable。即时通讯使用SQL精简服务器。
How to add identity column to datatable using c#. Im using Sql compact server.
推荐答案
您可以尝试这样的事情可能?
You could try something like this maybe?
private void AddAutoIncrementColumn()
{
DataColumn column = new DataColumn();
column.DataType = System.Type.GetType("System.Int32");
column.AutoIncrement = true;
column.AutoIncrementSeed = 1000;
column.AutoIncrementStep = 10;
// Add the column to a new DataTable.
DataTable table = new DataTable("table");
table.Columns.Add(column);
}
这篇关于如何添加标识列用c#的DataTable的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文