문제

I have to check a set of records with an id structure using simple.data. is there a way where i can find the last id entered? in reg sql i would do something like select top 1 of something desc but i am unsure of how to do it with simple.data.

thanks

도움이 되었습니까?

해결책

Very similar to how you would do if in SQL. I am assuming here that you have the id column set as an identity column or something, so to correctly order it I will order it by the id column, then get the top result:

db.TableName
    .All()
    .OrderByDescending(db.TableName.IdColumnName)
    .First()
    .IdColumnName
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top