Question: The following linq

```
var subjectMarks = (from DataRow row in objDatatable.Rows
                    select Convert.ToDecimal(row["EXM_MARKS"])).Sum();

```

throws an exception since some `row["EXM_MARKS"]` has non numeric values like `AB` etc.
How can I get the sum of only numeric ones out of them?

Answer: 
Add `where` clause that filters out the records that cannot be parsed as decimals. Try:

```
decimal dummy;

var subjectMarks = (from DataRow row in objDatatable.Rows
                     where decimal.TryParse(row["EXM_MARKS"], out dummy)
                     select Convert.ToDecimal(row["EXM_MARKS"])).Sum();

```
```
var subjectMarks = objDatatable.Rows.Where(row => row["EXM_MARKS"].ToString().All(char.isDigit))

```

part of solution is getted in: [here](https://stackoverflow.com/questions/4524957/how-to-check-if-my-string-only-numeric)