如何从1获得自动增量。 [英] how to get auto increment from 1.

查看:89
本文介绍了如何从1获得自动增量。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将数据绑定到datable中。现在我必须将列添加到Rowno以获取行号。



i使用以下代码获得解决方案:



i am binding data into datable. now i have to add to column as Rowno to get row numbers.

i got solution using below coding:

DataColumn Rowno= new DataColumn();
Rowno.DataType = System.Type.GetType("System.Int32");
Rowno.AutoIncrement = true;

column.AutoIncrementStep = 1;
chktb1.Columns.Add(Rowno);





chktb1是数据表,用于填充数据库中的记录。请不要建议从数据库中获取行号。在我的项目要求是需要从前端。所以,如何从1获得自动增量数。



我使用自动增量得到行号。但它从0开始。我需要,它应该从1开始。请帮助。



chktb1 is datatable which filled records from database. please do not suggest to get row number from database. in my project requirement is need from front end. so , how to get autoincrement number from 1.

I am getting row number using autoincrement . but it starts from 0. i need, it should start from 1. Please help.

推荐答案

试试这个!



Try this !

DataColumn dcl = new DataColumn();
dcl.AutoIncrement = true;
dcl.AutoIncrementSeed = 1;
dcl.AutoIncrementStep = 1;


这篇关于如何从1获得自动增量。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆