|
|
|
start date: Wed, 11 Jul 2007 19:58:03 -0600,
posted on: microsoft.public.dotnet.framework.adonet
back
| Thread Index |
|
1
Ronald S. Cook
|
|
2
Sergey Poberezovskiy
|
How write SQL's "ISNULL(ThemeRank, 255)" instead in ADO.NET when sorting DataView?
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
Date:Wed, 11 Jul 2007 19:58:03 -0600
Author:
|
RE: How write SQL's "ISNULL(ThemeRank, 255)" instead in ADO.NET when s
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";
"Ronald S. Cook" wrote:
> 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
>
>
>
>
>
Date:Wed, 11 Jul 2007 20:22:02 -0700
Author:
|
|
|