以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- [求助]cmd.CommandText = "Sele ct iif(单价>金额,单价,金额) As 金额,日期 from 销售明细 where 编号 = '480375' And 有效性='有效'" 出错 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=128457) |
-- 作者:ytzn -- 发布时间:2018/12/7 14:43:00 -- [求助]cmd.CommandText = "Sele ct iif(单价>金额,单价,金额) As 金额,日期 from 销售明细 where 编号 = '480375' And 有效性='有效'" 出错 Dim cmd As New SQLCommand cmd.C cmd.CommandText = "Sele ct iif(单价>金额,单价,金额) As 金额,日期 from 销售明细 where 编号 = \'480375\' And 有效性=\'有效\'" Dim dt As DataTable dt = cmd.ExecuteReader() 出错: \'>\' 附近有语法错误。 应该怎末写?多谢!
|
-- 作者:有点甜 -- 发布时间:2018/12/7 14:50:00 -- sqlserver数据库,要改成
cmd.CommandText = "Select (case when 单价>金额 then 单价 else 金额 end) As 金额,日期 from 销售明细 where 编号 = \'480375\' And 有效性=\'有效\'" [此贴子已经被作者于2018/12/7 14:49:48编辑过]
|
-- 作者:ytzn -- 发布时间:2018/12/7 14:59:00 -- 多谢甜老师 |