当前位置:编程学习 > VB >>

VB 修改数据库

ACCESS的
修改一条数据

conn.Execute "update biao1 set kucun = " & Text7 & " where numbel2 = " & Text10 & ""
本来这是可以的

现在要改成
conn.Execute "update biao1 set kucun = " & Val(Text7) - Val(Label6) & " where numbel2 = " & Text10 & ""

为什么说表达式不对啊 

就是 Val(Text7) - Val(Label6)
应该怎么写啊 

谢谢大家 --------------------编程问答-------------------- strP=cstr(val(text7)-val(label6))
conn.Execute "update biao1 set kucun = " & strP & " where numbel2 = " & Text10 & ""
--------------------编程问答-------------------- 好像还不行唉 --------------------编程问答-------------------- conn.Execute "update biao1 set kucun = " & Val(Text7.text) &" - "& Val(Label6.caption) & " where numbel2 = " & Text10 & ""
--------------------编程问答-------------------- 不行 
标准表达式中数据类型不匹配  

SOS --------------------编程问答--------------------
conn.Execute "update biao1 set kucun = '" & Val(Text7) - Val(Label6) & "' where numbel2 = '" & Text10 & "'"
--------------------编程问答-------------------- 关注中^ --------------------编程问答-------------------- 现在要改成
conn.Execute "update biao1 set kucun = " & CStr(Val(Text7) - Val(Label6)) & " where numbel2 = " & Text10
补充:VB ,  数据库(包含打印,安装,报表)
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,