I am retriving sum of all tution fees from the database where it is equal to the entered admission number. Data type for the columns in the SQL SERVER is decimal(10,2). When i want to convert to double it is showing error "Specified cast is not valid". How to convert to double?
SqlConnection con6 = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
con6.Open();
string query = "SELECT sum(tutionfee) FROM fees where admno='"+admissionnumber.Text+"'";
SqlCommand comSelect = new SqlCommand(query, con6);
double ID = (double)comSelect.ExecuteScalar();