@Rodel:Try adding the ProductName as your SORT parameter, the error will appear.
I've been burned with this behavior before. Although I haven't seen your .net code, I don't think that is the problem. Let's take the data precedence rule of Sql Server(unless noted, the rule is regardless of version)
udt -user defined type (highest) (sql 2005)
sql_variant
xml (sql 2005)
datetime
smalldatetime
float
real
decimal
money
smallmoney
bigint
int
smallint
tinyint
bit
ntext
text
image
timestamp
uniqueidentifier
nvarchar
nchar
varchar
char
varbinary
binary (lowest)
Let's say your sort columns are the following data types:
datetime
int
decimal
bit
varchar
nvarchar
char
If you specify, either datetime, decimal, int, bit column types as your sort order, there will have no problem. However, once you specificy either (n)varchar/chars columns you will get the error conversion type error. The reason for this although you were able to specify the column to sort, the CASE statement's return value is determined by data type precedence. So it will try to implicitly type cast the varchar to datetime, hence the error.
You can try the following simple test:
declare @p datetime
declare @v varchar(10)
declare @i int
select @i = 0, @p=getdate(), @v='text' -- change @i = 1 and there will be no error
select case @i when 1 then @p else @v end
What's the fix then? Explicitly cast the columns to varchars, but then again you'll not get the correct sort order(ie: cast int->varchar will result to sorting order of 1,10,2 not 1,2,10). I suggest in this case, use dynamic T-Sql as this is perfect for the situation. I don't even think you'll get the performance benefit of static sql as it will most of the time rely on index scan or worse table scan.