Создание веб-приложения, сочетающего в себе проектирование и создание баз данных, работу со сторонними форматами данных, программирование в NET и веб-разработку, страница 85

                dt.Clear();

                da = new MySqlDataAdapter(sql, conn);

                da.Fill(dt);

                report.DataBind();

                report.Rows[0].Cells[0].Text = pos.ToString();

                conn.Close();

            }

            catch (MySqlException exp)

            {

                conn.Close();

            }

            catch (Exception exp)

            {

                conn.Close();

            }

        }

        public static void getPlayerByNameOrAll(GridView report, string player)

        {

            string database = "powerplay";

            string password_db = "admin";

            string user_db = "root";

            string server_db = "localhost";

            connectionString = ("server=" + server_db + "; user id=" + user_db + "; password=" + password_db + "; database=" + database + "");

            MySqlConnection conn = null;

            try

            {

                //ОБЪЯВЛЕНИЕ

                conn = new MySqlConnection(connectionString);

                conn.Open();

                string sql;

                MySqlDataAdapter da = null;

                DataTable dt = new DataTable();

                //ВЫБИРАЕМ СТРОКУ ИЗ ТАБЛИЦЫ

                if (player != null)

                {

                    sql = "SELECT * FROM players WHERE name='"+player+"'";

                }

                else

                {

                    sql = "SELECT * FROM players ";

                }

                dt.Clear();

                da = new MySqlDataAdapter(sql, conn);

                da.Fill(dt);

                report.DataSource = dt;

                report.DataBind();

                conn.Close();

            }

            catch (MySqlException exp)

            {

                conn.Close();

            }

        }

        public static void getPrevGamesForTeam(GridView report, string team, string season)

        {

            string database = "powerplay";

            string password_db = "admin";

            string user_db = "root";

            string server_db = "localhost";

            connectionString = ("server=" + server_db + "; user id=" + user_db + "; password=" + password_db + "; database=" + database + "");

            MySqlConnection conn = null;

            try

            {

                //ОБЪЯВЛЕНИЕ

                string table_calendar = "calendar_khl20122013_1";

                string table_team_stats = season+"_teamstats";

                conn = new MySqlConnection(connectionString);

                conn.Open();

                string sql;

                MySqlDataAdapter da = null;

                DataTable dt = new DataTable();

                MySqlCommand comm = null;

                MySqlDataReader reader = null;

                int id_team = 0;

                int id_game = 0;

                //ВЫБИРАЕМ СТРОКУ ИЗ ТАБЛИЦЫ

                sql = "SELECT id FROM teams WHERE name = '" + team + "' ";

                comm = new MySqlCommand(sql, conn);

                reader = comm.ExecuteReader();

                while (reader.Read())

                {

                    id_team = Convert.ToInt32(reader[0].ToString());

                }

                reader.Close();

                if (id_team != 0)

                {