如何从SQL Server中获取自动接受的varchar值 [英] how to fetch autoincreamented varchar values from sql server

查看:79
本文介绍了如何从SQL Server中获取自动接受的varchar值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在页面加载事件中从sql server 2008中将自动删除的varchar值提取到asp.net中的文本框中.
假设我有一个响亮的trn_no,数据类型为varchar.如果将第一个值手动插入表中,例如T100,那么我将如何在pageload的文本框中获取值T101.请帮助我.

I want to fetch autoincreamented varchar values from sql server 2008 into a textbox in asp.net in pageload event.

suppose, i have a coloumn trn_no, data type varchar. if the 1st value inserted manually in the table, like T100,then how would i get the value T101 in the textbox in pageload.please help me.

推荐答案

不应该尝试.原因很简单:SQL是一个多用户系统.如果您有两个用户并排坐着,他们都将在查看T101,并希望这是他们输入的记录的ID.由于您不希望两个记录具有相同的编号,因此在写入记录之前不会应用自动递增.
You can''t, and shouldn''t try. The reason is simple: SQL is a Multi user system. If you have two users sitting next to each other, they will both be looking at T101 and expecting that to be the ID of the record they enter. Since you don''t want two records with the same number, the autoincrement is not applied until the record is written.


这篇关于如何从SQL Server中获取自动接受的varchar值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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