ehsan soltani

ehsan soltani

  • NA
  • 17
  • 2.4k

How To use Update of table in SQL with order the columns?

Jul 11 2015 5:41 AM
Dear My friends.
I have a gridview. It is binded to a sql data bank. Sql has a table with some columns (name, photo, score, rank, id).  My gridveiw shows some pictures which is saved in sql. The problem is that I could not show the rank. for example, I have two pictures, picture A has a score of 6 and picture B has a score of 8.  the rank of picture A is 2 and the rank of picture B is 1. Gridview shows the pictures and the rank (by using of datareader and " order by desc" for sorting the pictures based on score). But, when the table in sql is updated and for example the score of picture A changed to 9, its rank must be 1 and the rank of picture B must be 2. But by using of "order by score desc" the column of rank does not update. Therefore the gridview could not show the true rank of each picture. How to use update of table with sorting the table order by score?
Best Wishes