How write SQL's "ISNULL(ThemeRank, 255)" instead in ADO.NET when sorting DataView?

  • Thread starter Thread starter Ronald S. Cook
  • Start date Start date
R

Ronald S. Cook

In SQL, I can write:

SELECT *
FROM Product
ORDER BY ISNULL(ProductRank,255)

To return:

Alpha 1
Delta 2
Golf 3
Foxtrot 4
Charlie 5
Echo NULL
Bravo NULL


But how can I do this in ADO.NET in a DataView? Right now I just have:

view.Sort = "ThemeRank ASC";

I tried:

view.Sort = "ISNULL(ThemeRank, 255)";

but that didn't do the trick.

Any help would be greatly appreciated.

Thanks,
Ron
 
Ron,

you will need to create a calculated column that is the result of your
function in order to be able to sort on it, for example:

view.Table.Columns.Add("Calculated", typeof(int), "IsNull(ThemeRank, 255)");
view.Sort = "Calculated";
 
Back
Top