var connectionString = ConfigurationManager.ConnectionStrings["newproject"].ConnectionString;
SqlConnection cn = new SqlConnection(connectionString);
cn.Open();
string commandString = "select SUM(termfee ) as Total from newstd_termfee where admin_no='" + txtadmin .Text + "'";
SqlCommand sqlCmd = new SqlCommand(commandString, cn);
SqlDataReader read = sqlCmd.ExecuteReader();
while (read.Read())
{
textBox2.Text = read["Total"].ToString();
}
cn.Close();