varchar转int报语法错误

X北辰北
网络领域优质创作者
博客专家认证
2016-07-13 06:46:45
sqlbuy = "select * from goods where 进货年='&inty&' and 进货月='&intm&' and 进货日='&intd&' order by 生产厂商,总金额 desc"
...全文
583 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
道素 2016-07-14
  • 打赏
  • 举报
回复
应该是你最后生成的SQL语句中字符串类型的值没有用单引号括起来

sqlbuy = "select * from goods where 进货年='"&inty&"' and 进货月='"&intm&"' and 进货日='"&intd&"' order by 生产厂商,总金额 desc"
唐诗三百首 2016-07-13
  • 打赏
  • 举报
回复
拼接SQL语句的写法,

sqlbuy = "select * from goods where 进货年=" & inty & " and 进货月=" & intm & " and 进货日=" & intd & " order by 生产厂商,总金额 desc"
shoppo0505 2016-07-13
  • 打赏
  • 举报
回复
inty等变量是int类型吧? 需要用ToString()转换成string

594

社区成员

发帖
与我相关
我的任务
社区描述
提出问题
其他 技术论坛(原bbs)
社区管理员
  • community_281
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧