示例#1
0
        public static WhereToPlayCollection GetCollection()
        {
            WhereToPlayCollection tempList = null;

            using (SqlConnection myConnection = new SqlConnection(AppConfiguration.ConnectionString))
            {
                using (SqlCommand myCommand = new SqlCommand("usp_GetWhereToPlay", myConnection))
                {
                    myCommand.CommandType = CommandType.StoredProcedure;

                    myCommand.Parameters.AddWithValue("@QueryId", SelectTypeEnum.GetCollection);

                    myConnection.Open();
                    using (SqlDataReader myReader = myCommand.ExecuteReader())
                    {
                        if (myReader.HasRows)
                        {
                            tempList = new WhereToPlayCollection();
                            while (myReader.Read())
                            {
                                tempList.Add(FillDataRecord(myReader));
                            }
                        }
                        myReader.Close();
                    }
                }
            }
            return(tempList);
        }
        private void BindWhereToPlayList()
        {
            WhereToPlayCollection whereToPlayList = new WhereToPlayCollection();

            whereToPlayList = WhereToPlayDAL.GetCollection();

            rptWhereToPlayList.DataSource = whereToPlayList;
            rptWhereToPlayList.DataBind();
        }