If you get string value from DB.You have to change into string
string returnedLevel = (dr1[0].ToString());
you have to put "" while compare.try this
if (returnedLevel == "Semester")
{
int i = Convert.ToInt32(TextBoxNCC.Text);
int j = 168;
TextBoxNCCDR.Text = Convert.ToString(i / j);
}
else if (returnedLevel == "Quarter")
{
int i = Convert.ToInt32(TextBoxNCC.Text);
int j = 120;
TextBoxNCCDR.Text = Convert.ToString(i / j);
}
or if it is int,
you have to assign a value while declaring variable