问题
Could someone guide me on this. I am using EntityFramwork4 , I want to get the ID of the last row of a table. Could someone having experience using this tell me , how can i get the last id from a database table.
回答1:
Relational databases have no intrinsic order. There is no such thing as "the last row." Even if there were, multiuser concurrency would make this meaningless.
Max(id) probably doesn't solve your issue due to concurrency. But since you haven't told us what the real problem you're trying to solve is, it's hard to be sure.
来源:https://stackoverflow.com/questions/3975520/get-last-id-from-the-table-entity-framework