获取列表中的下一个号码 [英] Getting next number in list

查看:84
本文介绍了获取列表中的下一个号码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hi
我们有物品清单。每个人都有id'。我在这个列表中得到一个id然后如何使用sql 2012中的存储过程或c#代码获取此列表中的下一个id

请帮助我









提前致谢..

解决方案

sql

 选择  top   1  list.id 
来自列表
其中 list.id> @ id





或linq

< pre lang =c#> list。 where (l => l.id> yourId)。 orderby (L => l.id)。首先()


hi we have list of items. each one have id''s. i get one id in this list then how can i get next id in this list using stored procedure in sql 2012 or c# code
please help me




Thanks in advance..

解决方案

sql

Select top 1 list.id
from list
where list.id > @id



or linq

list.where(l=>l.id>yourId).orderby(l=>l.id).first()


这篇关于获取列表中的下一个号码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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