コード例 #1
0
ファイル: GameDetailDAL.cs プロジェクト: sjuhler131/Lottery
        public static GameDetailCollection GetCollection()
        {
            GameDetailCollection tempList = null;

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

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

                    myConnection.Open();
                    using (SqlDataReader myReader = myCommand.ExecuteReader())
                    {
                        if (myReader.HasRows)
                        {
                            tempList = new GameDetailCollection();
                            while (myReader.Read())
                            {
                                tempList.Add(FillDataRecord(myReader));
                            }
                        }
                        myReader.Close();
                    }
                }
            }
            return(tempList);
        }
コード例 #2
0
        private void BindGameDetailList()
        {
            GameDetailCollection gameDetailList = new GameDetailCollection();

            gameDetailList = GameDetailDAL.GetCollection();

            rptGameDetailList.DataSource = gameDetailList;
            rptGameDetailList.DataBind();
        }