I want get the last id from table. I’m using component blazor and i try do this:
int lastID = dl.db.myTable.FromSqlRaw("SELECT MAX(Id) FROM myTable");
I got the error CS0029: Cannot implicitly convert type ‘System.Linq.IQueryable’ to ‘int’
>Solution :
Try to use Linq
db.myTable.OrderByDescending(x => x.Id).FirstOrDefault();