依旧是又一条sql查询语句,还得麻烦各位了

freehorse_1981 2003-01-20 03:45:31
mysql = "select * into newtable from oldtable where " & cboField(0).Text & cboGX(0).Text & txtValue(0).Text
其中cbofield(0)字段,cboGX(0)是关系运算符,txtValue(0)是要查询的值。到底怎么回事儿啊,错误提示说“类型不匹配”
...全文
20 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
苏陌Bubble 2003-02-09
  • 打赏
  • 举报
回复
经验:
在测试程序时,执行查询前,你先把你的Sql查询语句用Msgbox(your_sql)一下看看,
到底你取出来的值组成字符串是什么样子的,有时候空格都会出现问题,查看后,问题自然就可以定位了.
xiaoweiwei1976 2003-01-20
  • 打赏
  • 举报
回复
cboField(0).Text & cboGX(0).Text & txtValue(0).Text
的类型已是字符型了!
不会再做什么运算了吧??


先运算出结果来,
再 dim strA as string
strA = ......

....like " % '& strA &' % " 试试。
xiaoweiwei1976 2003-01-20
  • 打赏
  • 举报
回复
cboField(0).Text & cboGX(0).Text & txtValue(0).Text
的类型已是字符型了!

....like " % & 'cboField(0).Text & cboGX(0).Text & txtValue(0).Text
' & % " 试试。
freehorse_1981 2003-01-20
  • 打赏
  • 举报
回复
debug后结果是:
select * into newtable from oldtable where biao > & txtValue(0).Text &
其中biao是cboField(0).Text
>是cboGX(0).Text
就是txtValue(0)的值取不出来
nssss 2003-01-20
  • 打赏
  • 举报
回复
mysql = "select * into newtable from oldtable where " & cboField(0).Text & cboGX(0).Text & val(txtValue(0).Text)
minajo21 2003-01-20
  • 打赏
  • 举报
回复
什么叫“txtValue(0).text取不对”呀?
有值吗?
freehorse_1981 2003-01-20
  • 打赏
  • 举报
回复
select * into newtable from oldtable where ziduan1 > & txtValue(0).Text &
就是txtValue(0).text取不对
minajo21 2003-01-20
  • 打赏
  • 举报
回复
debug.print mysql ,贴出来,看看什么问题
freehorse_1981 2003-01-20
  • 打赏
  • 举报
回复
还是不对啊
各位快帮忙啊
要不然我死定了
wuzhiliang 2003-01-20
  • 打赏
  • 举报
回复
同上
佛的光辉 2003-01-20
  • 打赏
  • 举报
回复
如果cboField(0).Text是字符类型的字段,应该写成
mysql = "select * into newtable from oldtable where " & cboField(0).Text & cboGX(0).Text & "'" & txtValue(0).Text & "'"
canyqf 2003-01-20
  • 打赏
  • 举报
回复
是不是值那儿没有加'符号的原因?

1,216

社区成员

发帖
与我相关
我的任务
社区描述
VB 数据库(包含打印,安装,报表)
社区管理员
  • 数据库(包含打印,安装,报表)社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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