Foxtable(狐表)用户栏目专家坐堂 → 这个语句在数据库中执行是正确的,确定时出错


  共有2289人关注过本帖树形打印复制链接

主题:这个语句在数据库中执行是正确的,确定时出错

帅哥哟,离线,有人找我吗?
xxfoxtable
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:七尾狐 帖子:1711 积分:16015 威望:0 精华:0 注册:2017/6/1 23:12:00
这个语句在数据库中执行是正确的,确定时出错  发帖心情 Post By:2019/11/12 12:34:00 [只看该作者]

cmd.CommandText="S ELECT  "cregno" = a.cregno,"cguestname" = (Case left(a.cregno,1) when 'S' then '非住客' else (s elect cguestname from ft_his_xs_reg_1 where cregno = a.cregno) end),"cguesttype" = (Case left(a.cregno,1) when 'S' then '非住客' when 'T' then '团体' else (s elect cguesttype from ft_his_xs_reg_1 where cregno = a.cregno) end), &  _
   "cpaytype" = (Case isnull(cyjflag,'N') when 'Y' then '押金' else (case when a.npayamt >= 0 then '结帐收款' else '结帐退款' end ) end),"paywayno" = a.cpaywayno, "paywayname" = IsNull(c.cpaywayname,a.cpaywayno), "face" = a.nface, "ngetamt" = a.ngetamt,  "change" = a.nchange,  & _  
         "npayamt" = a.npayamt, "voucherno" = a.cvoucherno, "memo" = a.cmemo, "operID" = a.coperID, "operdate" = a.dt_oper, "croomno" = (Case left(a.cregno,1) when 'T' then '团体' when 'S' then '非住客' else a.croomno end)  , "croomno1" = (Case left(a.cregno,1) when 'T' then '团体' when 'S' then '非住客' else a.croomno end)  , &  _
   "ccomputer" = a.ccomputer  FROM ft_his_xs_pay_2 a,  ft_pu_payway c   WHERE  ( a.cpaywayno *= c.cpaywayno ) And   ( a.dt_oper  >= 开始时间 ) And  ( a.dt_oper  <  结束时间 ) And  ( a.dt_oper  >= '" & dtp1.value &"') And   ( a.dt_oper  < '" & dtp2.value &"')"

图片点击可在新窗口打开查看此主题相关图片如下:1.png
图片点击可在新窗口打开查看


 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:107718 积分:547917 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2019/11/12 13:40:00 [只看该作者]

把列名的双引号全部去掉,"cregno" 改为cregno

 回到顶部
帅哥哟,离线,有人找我吗?
xxfoxtable
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:七尾狐 帖子:1711 积分:16015 威望:0 精华:0 注册:2017/6/1 23:12:00
  发帖心情 Post By:2019/11/12 14:02:00 [只看该作者]

去掉双引号后出现如下错误

图片点击可在新窗口打开查看此主题相关图片如下:1.png
图片点击可在新窗口打开查看


 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:107718 积分:547917 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2019/11/12 14:25:00 [只看该作者]

cmd.CommandText="S ELECT   a.cregno,(Case left(a.cregno,1) when 'S' then '非住客' else (s elect cguestname from ft_his_xs_reg_1 where cregno = a.cregno) end)  as cguestname,(Case left(a.cregno,1) when 'S' then '非住客' when 'T' then '团体' else (s elect cguesttype from ft_his_xs_reg_1 where cregno = a.cregno) end) as cguesttype, ....

 回到顶部