0

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

ghostfly
  • 3
  • 3

1 Answers1

1

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
Ben
  • 5,525
  • 8
  • 42
  • 66