Link to home
Start Free TrialLog in
Avatar of DCampbell2006
DCampbell2006

asked on

Total a column -- But if there is a alpha character skip that record

I have a web page that totals a field called Month Value. I have another field on the same page that displays YTD of the month value field. Users are allowed to enter NA or TBD in the month value field. I want to calculate the YTD values and skip the records that have a value of NA or YTD.
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

You could use double.TryParse to attempt to parse the field value:

double result = 0;
if (double.TryParse(dr["MonthValue"])
{
}

Bob
ASKER CERTIFIED SOLUTION
Avatar of JimBrandley
JimBrandley
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Forced accept.

Computer101
EE Admin