I'm new with C#. I would like some help finishing the code to execute a query to return the row number after an order by (currency). The table has user (person name) and currency (their amount of points). The query will order the database by currency then return the row number of that user (string input).
Table
user | currency
personname | #
This is what I have so far from googling.
public int overallrank(string user)
{
String sql = "SELECT (SELECT COUNT(*) FROM " + channel + " AS chan2 WHERE chan2.currency > chan1.currency ) as ChanRank FROM " + channel + " as chan1 WHERE chan1.user = ' " + user + "'";
cmd = new SQLiteCommand(sql, myDB);
var result = cmd.ExecuteScalar();
return result == DBNull.Value ? 0 : (int)result;
}