这样的分类Sql语句是写成例如Where B=@B And S=@S And A=@A这样么??还有更好的方法么?
string A = Request.QueryString["A"]; string B = Request.QueryString["B"]; string S = Request.QueryString["S"]; System.Text.StringBuilder sb = new StringBuilder(); sb.Append("select * from table1 where enable=1 "); if(A!=null)sb.Append(" and A=@a "); ... ...
string B = Request.QueryString["B"];
string S = Request.QueryString["S"];
System.Text.StringBuilder sb = new StringBuilder();
sb.Append("select * from table1 where enable=1 ");
if(A!=null)sb.Append(" and A=@a ");
...
...
B=&S=&A=s
它就会报错.