Sparrowvivek16

Ranking

Feb 24th, 2016
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.68 KB | None | 0 0
  1. con.Open();                    
  2.             string query = @"SET @rank=0;
  3.               SELECT player_ID'Player ID',player_name'Player Name',player_nick'Nick Name',HP'High Score', @rank:=@rank+1 As Rank
  4.               FROM player_profile ORDER BY HP DESC;";
  5.             MySqlCommand cm = new MySqlCommand(query, con);
  6.             cm.Parameters.AddWithValue("@1", ID);
  7.             var re = cm.ExecuteReader();
  8.             while (re.Read())
  9.             {
  10.                 Label37.Text = re.GetInt32("rank").ToString();              
  11.             }
  12.             con.Close();
  13.  
  14. i want to get the rank of the specific player's ID but instead i just get the last player's rank.
  15. any help?
Add Comment
Please, Sign In to add comment