I inserted the data into a table using Entity Framework but now I need to retrieve the last id from last executed query.
Here is my code
var filedbdata = "'" + FileTitle + "'" + "," +
"'" + path + "'" + "," +
"'" + Session["UserID"] + "'";
var query = "insert into File_Upload(file_title,file_loc,file_userid) values(" + filedbdata + ")";
db.Database.ExecuteSqlCommand(query);
db.SaveChanges();
int lastid = ??