Reputation: 2036
I want to connect the SqlDataSource to the grid view and change the sorting data dynamically with a dropdownlist. I used this code and it gave me this error:
code:
SELECT ...
FROM ...
ORDER BY
CASE WHEN @order='Country' THEN Country END DESC,
CASE WHEN @order='City' THEN City END ASC,
CASE WHEN @order='name' THEN name END ASC
error: The CLR type does not exist or you do not have permissions to access it.
can any body help me?
Upvotes: 0
Views: 71
Reputation: 10680
Try to change your ORDER BY clause to something like this:
SELECT ...
FROM ...
ORDER BY
CASE @order WHEN 'Country' THEN Country ELSE 1 END DESC,
CASE @order WHEN 'City' THEN City WHEN 'name' THEN name ELSE 1 END ASC
Upvotes: 1