在Web表单中检索表的主键列的下一个值 [英] Retrieve next value of table's primary key column in the web form

查看:76
本文介绍了在Web表单中检索表的主键列的下一个值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

先生,

我要在订单表的Web窗体的文本框中自动使用下一个订单号.每当我打开订单"网络表单时,下一个订单就不会自动出现.请通过示例告诉我代码.

Sir,

I want to use next Order no in the Web Form''s textbox from the order table automatically. whenever i open my Order web form the next order no comes automatically. please tell me code with the example.

推荐答案

Letz使用下面的表创建SQL将订单号定义为标识主列:
Letz define Order Number as identity primary column using the below table creation SQL as:

CREATE TABLE dbo.MyTable
(
    OrderNo int NOT NULL PRIMARY KEY,
    OtherKey varchar(50),
    ....
) 




SQL从1开始将其保留为标识主列.在每个SELECT命令上,SQL自动检索下一个数字




SQL maintains this column as identity primary column, starting from 1. On every SELECT command, SQL retrieve the next number automatically

SELECT OrderNo from MyTable


这篇关于在Web表单中检索表的主键列的下一个值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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