如何在asp.net中插入后回读自动编号 [英] How do I read back autonumber after do an insert in asp.net

查看:58
本文介绍了如何在asp.net中插入后回读自动编号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法使用''datareader''找出我刚刚插入的记录的自动编号字段

值?

谢谢,

- cohenmarvin

Is there any way using a ''datareader'' to find out the autonumber field
value of a record that I''ve just inserted?
Thanks,
-- cohenmarvin

推荐答案

这取决于您使用的数据库。如果您使用的是SQL Server

这应该可行:


SELECT @@ Identity


-

T. DAVIS JR


- .NET将改变开发人员开发应用程序的方式

" COHENMARVIN" <共********* @ hotmail.com>在消息中写道

news:11 ********************** @ g43g2000cwa.googlegr oups.com ...
Well it depends on what database you are using. If you are using SQL Server
this should work:

SELECT @@Identity

--
T. DAVIS JR

- .NET will change the way developers develop applications
"COHENMARVIN" <co*********@hotmail.com> wrote in message
news:11**********************@g43g2000cwa.googlegr oups.com...
有没有办法使用''datareader''找出我刚插入的记录的自动编号字段
值?
谢谢,
- cohenmarvin
Is there any way using a ''datareader'' to find out the autonumber field
value of a record that I''ve just inserted?
Thanks,
-- cohenmarvin



COHENMARVIN写道:
COHENMARVIN wrote:
有没有办法使用''datareader''找出自动编号字段
我刚刚插入的记录的价值?
谢谢,
- cohenmarvin
Is there any way using a ''datareader'' to find out the autonumber field
value of a record that I''ve just inserted?
Thanks,
-- cohenmarvin




你最好打赌是首先避免使用自动编号。

如果你自己分配,生活会更容易


-

Curt Christianson

网站: http://www.darkfalz.com

博客: http://blog.darkfalz.com


" Curt_C [MVP]" < software_at_darkfalz.com>在新闻中写道:#OTlPBfnFHA.2156

@ TK2MSFTNGP14.phx.gbl:
"Curt_C [MVP]" <software_at_darkfalz.com> wrote in news:#OTlPBfnFHA.2156
@TK2MSFTNGP14.phx.gbl:
COHENMARVIN写道:
COHENMARVIN wrote:
有没有办法使用''datareader''查找我刚刚插入的记录的自动编号字段值
谢谢,
- cohenmarvin
Is there any way using a ''datareader'' to find out the autonumber field
value of a record that I''ve just inserted?
Thanks,
-- cohenmarvin



你最好的选择是避免首先使用自动编号。
如果你自己分配生活会更容易



You''re best bet is to avoid using autonumber in the first place.
Life is MUCH easier if you assign it yourself




? ??然后你会遇到生成重复的可能性...


-

Lucas Tam(RE ******** @ rogers。 com)

请删除删除来自回复时的电子邮件地址。
http://成员。 ebay.com/aboutme/coolspot18/


这篇关于如何在asp.net中插入后回读自动编号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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