您当前的位置: 百科371电脑/网络C#/.NET → 电脑/网络内容 退出登录 用户管理 用户注册
本类热门文章
相关文章
中原建材网
SQL语句又有问题了

减小字体 增大字体

问题:select id,tupian,mingcheng,bianhao,case when youhuijia=0 then jiage else <font style=\text-decoration:line-through\>+jiage+</font> end as jiage,caizhi,case when youhuijia=0 then   else youhuijia end as youhuijia from shangpin where id in(select shangpinid from shoucang where yonghuid=@id)错误:将 varchar 值 <font style=text-decoration:line-through> 转换为数据类型为 int 的列时发生语法我是想优惠价为0的话就只显示原价,否则把原价划掉,用时显示优惠价  

else '<font style=\"text-decoration:line-through\">'+jiage+'</font>' end
改成

else '<font style=\"text-decoration:line-through\">'+cast(jiage as varchar(20)+'</font>' end

就可以了
-----------------------------------------------------------------
CONVERT 和cast功能本来就一样的.不过你只是简单转换的话..最好用cast

如果你对select id,tupian,mingcheng,bianhao,case when youhuijia=0 then jiage else <font style=\text-decoration:line-through\>+jiage+</font> end as jiage,caizhi,case when youhuijia=0 then   else youhuijia end as youhuijia from shangpin where id in(select shangpinid from shoucang where yonghuid=@id)错误:将 varchar 值 <font style=text-decoration:line-through> 转换为数据类型为 int 的列时发生语法我是想优惠价为0的话就只显示原价,否则把原价划掉,用时显示优惠价这个问题有好的意见或 建议,请留言
[] [返回上一页] [打 印]
电脑/网络评论 (评论内容只代表网友观点,与本站立场无关!)

用户名: 查看更多评论

分 值:100分 85分 70分 55分 40分 25分 10分 0分

内 容:

         (注“”为必填内容。) 验证码: 验证码,看不清楚?请点击刷新验证码

中原建材网 简单版 站长QQ:382546553