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

                    dt.Clear();

                    da = new MySqlDataAdapter(sql, conn);

                    da.Fill(dt);

                    report.DataSource = dt;

                    report.DataBind();

                    if (report != null)

                    {

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

                        report.Rows[0].BackColor = System.Drawing.Color.Beige;

                    }

                }

                else

                {

                    if (report != null)

                    {

                        for (int i = 0; i < report.Rows.Count; i++)

                        {

                            report.Rows[i].Cells[0].Text = (i + 1).ToString();

                            if (i % 2 == 0) report.Rows[i].BackColor = System.Drawing.Color.Beige;

                            else report.Rows[i].BackColor = System.Drawing.Color.LightGray;

                        }

                    }

                }

                if (report != null)

                {

                    report.RowStyle.Wrap = false;

                    report.HeaderRow.BackColor = System.Drawing.Color.LightBlue;

                    report.HeaderRow.ForeColor = System.Drawing.Color.Black;

                    report.ForeColor = System.Drawing.Color.DimGray;

                    report.HeaderRow.Cells[0].Text = "#";

                    report.HeaderRow.Cells[8].Text = "+/-";

                    report.HeaderRow.Cells[10].Text = "pim/g";

                    report.HeaderRow.Cells[18].Text = "so%";

                    report.HeaderRow.Cells[21].Text = "s%";

                    report.HeaderRow.Cells[23].Text = "fo%";

                    report.HeaderRow.Cells[25].Text = "toi/g";

                    report.HeaderRow.Cells[26].Text = "sft/g";

                }

                conn.Close();

            }

            catch (MySqlException exp)

            {

                conn.Close();

            }

        }

        //public static void getReportOfPlayerByName(GridView report, string player, 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_players_stats = season + "_playersstats";

        //        conn = new MySqlConnection(connectionString);

        //        conn.Open();

        //        string sql;

        //        MySqlDataAdapter da = null;

        //        DataTable dt = new DataTable();

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

        //        if (player != null)

        //        {