如何为+1账单号进行每次 [英] How to do +1 bill No. Each and every time

查看:105
本文介绍了如何为+1账单号进行每次的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的所有人
我正在尝试创建一个类似计费软件的项目.在这种形式下,我有一个文本框,用于显示帐单号.现在我想为上一次的帐单号码+1.

我很忙,但在运行时每次都不会刷新



请帮助我...................

Dear All
I am trying to create a project like billing software. in this form i have a text box for bill no. and now i want to +1 every time of last bill no.

i am tring a lot but at run time it is not refreshing every time



please help me ...................

推荐答案

最简单的方法是将帐单号字段创建为身份"字段:这样,SQL Server会为您处理.然后,您无需指定字段内容,当您使用INSERT命令时,SQL Server将为其分配一个新的递增值.
为此:

在SQL Server Management Studio中,创建表.
创建BillNo字段,作为int.
在属性"中,展开身份规范".
将(是身份)"更改为是"

完成!
The easiest way is to create the bill number field as an Identity field: that way SQL Server will take care of it for you. You then don''t specifiy the field content, SQL server will assign it a new, incremented value when you use the INSERT command.
To do that:

In SQL server Management Studio, create your table.
Create the BillNo field, as an int.
In the Properties, expand "Identity Specification".
Change "(Is Identity)" to "Yes"

Done!


您好,在将身份种子设置为1之后使用OriginalGriff答案.它将解决您的问题.
Hi Use OriginalGriff answer after that set identity seed to 1. it will solve your problem.


如果您要使用数据库表帐单号,只需将帐单号设置到标识列,然后使用@@ identity(
If you are using a database table for the bill number, just set bill no to an identity column and then get the last bill number using @@identity(here[^]) and then add one to it.


这篇关于如何为+1账单号进行每次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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