我在我的陈述中看到此错误 [英] i am looking this error in my statment

查看:90
本文介绍了我在我的陈述中看到此错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

ssql = "insert into inward_master(inwardno,inwdate,intype,site,dept,sguard,vehno,str_recby,enterby) values" & _
           "('" & Me.txtinward.Text & "' ,'" & Format(Me.dtinward.Value, "MM/dd/yyyy") & "'," & _
           "'" & Me.cmbintype.Text & "'," & _
           "'" & loginsite & "','" & Me.txtdeptno.Text & "'," & _
           "'" & Me.txtsg.Text & "'" & _
           "'" & Me.txtveh.Text.Trim & "'" & _
           ",'" & Me.txtrec.Text & "', '" & login & "')"



当我执行查询时,它说.您的插入语句中有更多col.then值.

请帮助我



when i execute query then it says.there are more col in ur insert statment.then values.

plz help me

推荐答案

您的列列表中有10个项目,但您只插入了9个.

str可能是多余的.
There is 10 items in your columns list but you are inserting only 9.

The str could be extra.


首先从更改此行开始
First start by changing this line
"'" & Me.txtsg.Text & "'" & _


并在其中添加,"


and adding a '','' to them

"'" & Me.txtsg.Text & "'," & _


现在看看会发生什么.

您可能需要更改代码,以便在将''和添加到语句中时保持一致.现在的方式很难阅读.

另外,您可能想研究参数化查询 [ datetime类型 [ ^ ].


Now see what happens.

You might want to change your code so that you are consistent in how you add the '' and , to the statement. The way it is now is very hard to read.

Also you might want to look into to parameterized queries[^].

And as a final note do not store date as a string but use the datetime type[^].


这篇关于我在我的陈述中看到此错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆