catch (MySqlException exp)
{
conn.Close();
}
}
public static void getStatsOfTeams(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_team_stats = season+"_teamstats";
//ОБЪЯВЛЕНИЕ
conn = new MySqlConnection(connectionString);
conn.Open();
string sql;
MySqlDataAdapter da = null;
DataTable dt = new DataTable();
//ВЫБИРАЕМ СТРОКУ ИЗ ТАБЛИЦЫ
sql = "select teams.id as r,teams.name as team,sum(" + table_team_stats + ".ratingppl) AS ppl,sum(" + table_team_stats + ".gp) AS gp,sum(" + table_team_stats + ".w) AS w,sum(" + table_team_stats + ".w_ot) as wot,sum(" + table_team_stats + ".w_so) as wso,sum(" + table_team_stats + ".l_so) as lso,sum(" + table_team_stats + ".l_ot) as lot,sum(" + table_team_stats + ".l) as l,sum(" + table_team_stats + ".p) as p,ROUND(sum(" + table_team_stats + ".p)/(select tournaments.w from tournaments where tournaments.id = (select conferences.league from conferences inner join divisions on divisions.conference = conferences.id inner join teams on divisions.id=teams.division inner join " + table_team_stats + " on teams.id = " + table_team_stats + ".team)*sum(" + table_team_stats + ".gp))*100,1) as per,sum(" + table_team_stats + ".gf) as gf,sum(" + table_team_stats + ".ga) AS ga, sum(" + table_team_stats + ".gf)-sum(" + table_team_stats + ".ga) AS d,sum(" + table_team_stats + ".sho_w) as sw,sum(" + table_team_stats + ".sho_l) as sl,sum(" + table_team_stats + ".pp) as pp,sum(" + table_team_stats + ".pp_w) as ppg,sum(" + table_team_stats + ".pp_ga) as ppga,ROUND(sum(" + table_team_stats + ".pp_w)/sum(" + table_team_stats + ".pp)*100,1) as pper,sum(" + table_team_stats + ".pk) as pk,ROUND(sum(" + table_team_stats + ".pk_w)/sum(" + table_team_stats + ".pk)*100,1) as pker,sum(" + table_team_stats + ".pk_g) as pkg,ROUND(sum(" + table_team_stats + ".s_g)/sum(" + table_team_stats + ".gp),1) as s,ROUND(sum(" + table_team_stats + ".sa_g)/sum(" + table_team_stats + ".gp),1) as sa,ROUND(sum(" + table_team_stats + ".g1_w)/sum(" + table_team_stats + ".g1)*100,1) as g1w,ROUND(sum(" + table_team_stats + ".ga1_w)/sum(" + table_team_stats + ".ga1)*100,1) as ga1w,ROUND(sum(" + table_team_stats + ".os_g)/sum(" + table_team_stats + ".os)*100,1) as os,ROUND(sum(" + table_team_stats + ".osa_g)/sum(" + table_team_stats + ".osa)*100,1) as osa,ROUND(sum(" + table_team_stats + ".fo_w)/sum(" + table_team_stats + ".fo)*100,1) as fo from " + table_team_stats + " inner join teams on teams.id = " + table_team_stats + ".team group by " + table_team_stats + ".team order by per DESC";
dt.Clear();
da = new MySqlDataAdapter(sql, conn);
da.Fill(dt);
report.DataSource = dt;
report.DataBind();
for (int i = 0; i < report.Rows.Count; i++)
{
Уважаемый посетитель!
Чтобы распечатать файл, скачайте его (в формате Word).
Ссылка на скачивание - внизу страницы.