每当我在查询中加上 case 时,它会出现错误"指定的强制转换无效"在linq到sql C#但是 它在Sql server 2008中运行良好。
使用
查询iamselect Prod_StyleID,S.STYLECODE,STYLENAME,CATEGORYNAME,VENDORNAME,STYLESTATUS,Gendername,
STYLEDESCRIPTION,SHORTDESCRIPTION1,SHORTDESCRIPTION2,SHORTDESCRIPTION3,SHORTDESCRIPTION4,STYLEPRICE,
BRANDNAME,VENDORSTYLECODE,CATEGORYTYPE,1 as ColorATtribute,1 as SizeAttribute,
case when s.styleprice = '0' then sp.regularprice when s.styleprice = '1' then
sp.saleprice else closeoutprice end as Regularprice from prod_style S inner join prod_styleprice SP on s.stylecode = sp.stylecode where (S.STYLECODE LIKE @stylecode+'%' OR S.VENDORSTYLECODE like @stylecode+'%')
and S.CATEGORYNAME <> 'Made to Order' and S.STYLESTATUS = 'Active' and sp.pricefrom ='1'
请帮助