try
{
//ОБЪЯВЛЕНИЕ
conn = new MySqlConnection(connectionString);
conn.Open();
string team = "";
string sql;
MySqlDataAdapter da = null;
DataTable dt = new DataTable();
MySqlCommand comm = null;
MySqlDataReader reader = null;
string league_filter = "";
int id_league =0 ;
//ВЫБИРАЕМ ID КОМАНДЫ
if (!league.Equals("") && league != null)
{
sql = "SELECT id FROM tournaments WHERE name='"+league+"' ";
comm = new MySqlCommand(sql, conn);
reader = comm.ExecuteReader();
while (reader.Read())
{
id_league = Convert.ToInt32(reader[0].ToString());
}
reader.Close();
}
if (id_league != 0)
{
league_filter = " inner join divisions on divisions.id = teams.division inner join conferences on divisions.conference = conferences.id and conferences.league = "+ id_league +" ";
}
else
{
league_filter = "";
}
sql = "SELECT teams.id, teams.abb, teams.name as team, teams.city, divisions.name as division, conferences.name as conference FROM teams " + league_filter + ";";
dt.Clear();
da = new MySqlDataAdapter(sql, conn);
da.Fill(dt);
report.DataSource = dt;
report.DataBind();
conn.Close();
}
catch (MySqlException exp)
{
conn.Close();
}
}
public static string getTabForGame(int game, 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";
string table_calendar = "calendar_khl20122013_1";
conn = new MySqlConnection(connectionString);
conn.Open();
string sql;
MySqlCommand comm = null;
MySqlDataAdapter da = null;
DataTable dt = new DataTable();
MySqlDataReader reader = null;
string tab = "";
GridView report = new GridView();
//ВЫБИРАЕМ ID КОМАНДЫ
sql = "SELECT " + table_team_stats + ".game," + table_team_stats + ".team," + table_team_stats + ".rival," + table_team_stats + ".w," + table_team_stats + ".w_ot," + table_team_stats + ".w_so," + table_team_stats + ".l_so," + table_team_stats + ".l_ot," + table_team_stats + ".l," + table_team_stats + ".gf," + table_team_stats + ".ga," + table_calendar + ".home," + table_calendar + ".away FROM " + table_team_stats + " inner join " + table_calendar + " on " + table_calendar + ".id = " + table_team_stats + ".game WHERE game=" + game + "";
Уважаемый посетитель!
Чтобы распечатать файл, скачайте его (в формате Word).
Ссылка на скачивание - внизу страницы.