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

                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 getReportOfGoalieByParams(string team, string indicator, GridView report, 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_goalie_stats = season+"_goaliestats";

                conn = new MySqlConnection(connectionString);

                conn.Open();

                string sql;

                int pos = 0;

                MySqlDataAdapter da = null;

                DataTable dt = new DataTable();

                string team_filter = "";

                int player_id;

                string sort = "";

                //ВЫБИРАЕМ ID КОМАНДЫ

                if (team != null && team != "")

                {

                    team_filter = " AND teams.name = '" + team + "' ";

                }

                else

                {

                    team_filter = "";

                }

                if (indicator.Equals("gaa"))

                {

                    sort = "ASC";

                }

                else

                {

                    sort = "DESC";

                }

                /*НАХОДИМ ИГРОКА, ЛИДЕРА ВНУТРИ КОМАНДЫ*/

                sql = "select " + table_goalie_stats + ".player,players.name,teams.abb,sum(" + table_goalie_stats + ".gp) as GP,sum(" + table_goalie_stats + ".gs) as GS,sum(" + table_goalie_stats + ".w) as W,sum(" + table_goalie_stats + ".w_ot) as WOT,sum(" + table_goalie_stats + ".w_so) as WSO,sum(" + table_goalie_stats + ".l) as L,sum(" + table_goalie_stats + ".l_ot) as LOT,sum(" + table_goalie_stats + ".l_so) as LSO,sum(" + table_goalie_stats + ".so) as SO, sum(" + table_goalie_stats + ".so_sv) as SOSV,ROUND(sum(" + table_goalie_stats + ".so_sv)/sum(" + table_goalie_stats + ".so)*100,2) as SOSV_per,sum(" + table_goalie_stats + ".sa) as SA,sum(" + table_goalie_stats + ".ga) as GA,ROUND(60*sum(" + table_goalie_stats + ".ga)/sum(" + table_goalie_stats + ".toi),2) as GAA,ROUND((sum(" + table_goalie_stats + ".sa)-sum(" + table_goalie_stats + ".ga))/sum(" + table_goalie_stats + ".sa)*100,2) as SV_per,sum(" + table_goalie_stats + ".sho) as SHO,sum(" + table_goalie_stats + ".g) as G,sum(" + table_goalie_stats + ".a) as A,sum(" + table_goalie_stats + ".pim) as PIM,ROUND(sum(" + table_goalie_stats + ".toi),2) as TOI from " + table_goalie_stats + " inner join teams on teams.id = " + table_goalie_stats + ".team " + team_filter + " inner join players on players.id = " + table_goalie_stats + ".player group by " + table_goalie_stats + ".player ORDER by " + indicator + " " + sort + "";