首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VB >

SQL 语句异常 高手帮小弟我看看!

2012-01-13 
SQL 语句错误 高手帮我看看!!!Cnn.Executeupdate工资结算set&Mid(Label1(i),1,Len(Label1(i))-1)& +T

SQL 语句错误 高手帮我看看!!!
Cnn.Execute   "update   工资结算   set   "   &   Mid(Label1(i),   1,   Len(Label1(i))   -   1)   &   "= "   +   Text1(i)   +   "   where   日期   =   ' "   +   Text1(0)   +   " 'and   工号= ' "   +   Text1(1)   +   " ' "


实时错误:
                          至少一个参数没有被指定值.

我用的是access数据库


[解决办法]
需要调试
把语句修改一下
dim strsql as string
strsql= "update 工资结算 set " & Mid(Label1(i), 1, Len(Label1(i)) - 1) & "= " + Text1(i) + " where 日期 = ' " + Text1(0) + " 'and 工号= ' " + Text1(1) + " ' "

Cnn.Execute strsql
跟踪调试一下变量strsql看看哪个参数有问题。
[解决办法]
try

"update 工资结算 set " & Mid(Label1(i), 1, Len(Label1(i)) - 1) & "= "& Text1(i) & " where 日期 = # "& Text1(0) & "# and 工号= ' "& Text1(1) & " ' "

热点排行