C# OrderBy记录ASC分为两列

C# OrderBy记录ASC分为两列,c#,form-load,C#,Form Load,我正在尝试在windows应用程序中以我的列的形式大声排序。我尝试使用以下代码: using (SqlCommand sqlcomm = new SqlCommand("SELECT * FROM remaining WHERE username=@username and status=@status and company_status=@company_status ORDER BY call_case ASC , Payment_Status ASC", sqlconn)) 这样做对吗

我正在尝试在windows应用程序中以我的列的形式大声排序。我尝试使用以下代码:

using (SqlCommand sqlcomm = new SqlCommand("SELECT * FROM remaining WHERE username=@username and status=@status and company_status=@company_status ORDER BY call_case ASC , Payment_Status ASC", sqlconn))
这样做对吗

我要找的是OrderBy(call_case)ASC,以及call_case=(2-Answer)OrderBy(Payment_Status)ASC


我有一个注释,它是我的帮助,文本以数字开头,如1-无答案,2-答案,3-不存在


您可以使用
大小写
表达式以及
排序依据

SELECT * FROM remaining 
WHERE username=@username 
and status=@status 
and company_status=@company_status 
ORDER BY      
   case when call_case='Answer' then 0 else 1 end ASC,      
   Payment_Status ASC

这是我想要的吗?@ahmed为什么不试试看
使用(SqlCommand sqlcomm=new SqlCommand(“从用户名=@username and status=@status and company_status=@company_status=@company_status ORDER BY CASE when call_CASE='2-Answer',然后0其他1结束ASC付款_statusASC,sqlconn))
我尝试了一下,它给我的(付款状态附近的语法不正确)是
结束ASC,付款状态
我有一个注释它是我的帮助文本以数字开头,如1-无答案,2-答案,3-不存在
SELECT * FROM remaining 
WHERE username=@username 
and status=@status 
and company_status=@company_status 
ORDER BY      
   case when call_case='Answer' then 0 else 1 end ASC,      
   Payment_Status ASC