I am trying to parse the retried value from the database into double
, long
, or integer
, but it throws a FormatException. I need your help.
In this code, I am trying to retrieve hours from the database and sum them to calculate total hours input into the database.
String hrs;
Double resultHrs=0;
while (oleDbDataReader1.Read())
{
hrs = oleDbDataReader1["Hours"].ToString();
double HRS = double.Parse(oleDbDataReader1["Hours"].ToString());
resultHrs = resultHrs + HRS;
}// end while