Sorting not working when SQL query is sent from C# and appended in the procedure

I have this query sent from a C# application to a stored procedure, but this doesn't work. When copied and run from SQL Server it works.

case "asc":
    additionalSortQuery += @", CASE nat.mask
                                  WHEN ''In Process'' THEN 0
                                  WHEN ''Ineligible'' THEN 1
                                  WHEN ''Inpatient'' THEN 2
                                  WHEN ''Outreach In Process'' THEN 3
                                  WHEN ''Level 3'' THEN 4
                                  WHEN ''Level 2B'' THEN 5
                                  WHEN ''Level 2A'' THEN 6
                                  WHEN ''Level 1'' THEN 7 
                               END ASC"; 
    break;

Upvotes: 2

Views: 98

Answers (1)

Richard Schneider
Richard Schneider

Reputation: 35464

Use a single quote not two quote marks.

Upvotes: 3

Related Questions