select * from AC_ChinaArea where F_AreaID like '11%' order by F_AreaId desc放到Datatable结果集里面肯定是带参数的
select * from AC_ChinaArea where F_AreaID like '%'+@F_AreaId+'%' order by F_AreaId asc可是+@F_AreaId取出来的是110100,可我只想根据前面两位去判断取出来的数据  语句怎么写??? 

解决方案 »

  1.   

    截取前两位啊,C#里或者SQL里都能做到
      

  2.   

    前面就不要加%号了撒
    select * from AC_ChinaArea where F_AreaID like ''+@F_AreaId+'%' order by F_AreaId asc
      

  3.   


    在sql里怎么做到啊 ?
      

  4.   


    string F_AreaId = "110100"; //你自己取string strSQL = "select * from AC_ChinaArea where F_AreaID like '"+F_AreaId.Substring(0,2)+"%' order by F_AreaId asc";
      

  5.   

    select * from AC_ChinaArea where F_AreaID like SUBSTRING('11000000',0,2)+'%' order by F_AreaId asc