自动递增ID号 [英] Auto Increment ID Number

查看:85
本文介绍了自动递增ID号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好。所有



我需要自动增加ID



开始ID:S100



下次需要S101



请告诉我这是怎么做的

解决方案

希望帮助:

你可以先在数据库中获取最后一个值,然后增加它并插入新记录!

  int 增量;  //  < span class =code-comment>一个int变量将指定数字。 
// 获取最后一个值并将其保存到Increment中。
System.Text.StringBuilder sb = new System.Text.StringBuilder( s); // 这里你可以附上自定义字符
增量++; // 增加变量
sb.Append(Increment.ToString());
// 插入价值增加的新记录


Hi. All

I need auto Increment in ID

Start ID : S100

Next time i need S101

Please tell me how i do for this

解决方案

hope help :
you can first get last value in the database then increase it and insert new record !

int Increment;// an int variable will specify the number.
// get last value and save it into Increment.
System.Text.StringBuilder sb = new System.Text.StringBuilder("s");// here u can attach ur custom character
Increment++;//increase variable
sb.Append(Increment.ToString());
//insert new record with increased value


这篇关于自动递增ID号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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