Пример #1
0
 internal List <Student> CountryInfo()
 {
     try
     {
         a               = conn.getConnection();
         listContry      = new List <Student>();
         cmd             = new SqlCommand("test_GetCountryInfo", a);
         cmd.CommandType = System.Data.CommandType.StoredProcedure;
         a.Open();
         SqlDataReader reader = cmd.ExecuteReader();
         while (reader.Read())
         {
             stdnt             = new Student();
             stdnt.CountryID   = Convert.ToInt32(reader["countryID"].ToString());
             stdnt.countryName = Convert.ToString(reader["countryName"]);
             listContry.Add(stdnt);
         }
     }
     catch
     {
         //throw new Exception("Error : " + ex.Message);
         return(listContry);
     }
     finally
     {
         a.Close();
     }
     return(listContry);
 }