By googling i have made following select query to take max value of column ID.

```
 var result = (from rs in db.tradeFiles

                             select (rs.ID)).Max();

```

Please let me know is this a query is write for taking max value of column ID.

And for taking data out of it in variables i used foreach loop in following manner which is also not working.

```
foreach(var item in result)
           {

           }

```

Please let me know what is the mistake and what is the correct way to pull out the data out of select query.