如何获得带有linq-entity的下一条记录? [英] How do I get the next record with linq-entity?
问题描述
正在从事实体框架工作
我希望当我单击下一步按钮时在文本框中显示下一条记录
我具有以下结构
ID,客户ID,名称,其中ID为主键
ID客户ID名称1 4 aa
4 6 bbb
5 9 ccc
8 10 ddd
如果当前行id为4,我想获取id == 5的行并将其显示在
texboxes
正在尝试以下代码
int next = convert.toint32(textbox1.text);
Hi,
am working on entity frame work
i want the next record to be display in the textboxes when i click next button
i have below structure
ID,CustomerID,name where ID is the primarykey
ID CustomerID name 1 4 aa
4 6 bbb
5 9 ccc
8 10 ddd
if current row id is 4 ,i want to get the row where id==5 and display it in
texboxes
am trying below code
int next=convert.toint32(textbox1.text);
testingEntities te = new testingEntities();
var entity = (from n in te.tblddls
where n.id == next
orderby n.id
select n).Skip(1).Take(1);
return entity;
输出为空
谢谢inadvance
am getting null as output
Thanks inadvance
推荐答案
大家好,
hi all,
int next = Convert.ToInt32(TextBox1.Text);
testingEntities te = new testingEntities();
var entity = (from t in te.tblddls
where t.id > next
orderby t.id
select t).FirstOrDefault();
这篇关于如何获得带有linq-entity的下一条记录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!