Question

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

Was it helpful?

Solution

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
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top