早教吧作业答案频道 -->其他-->
急!vb实时错误‘-2147217900(80040e14)’where字句语法错误PrivateSubCommand5Click()Dimwherewhere=""xingming=Text2.Textxingbie=Combo3.Textjiguan=Text22.Textshengri=Text21.Textxueli=Text23.Textzhuanye=Text24.Tex
题目详情
急!vb 实时错误‘-2147217900 (80040e14)’ where字句语法错误Private Sub Command5_Click() Dim where where = "" xingming = Text2.Text xingbie = Combo3.Text jiguan = Text22.Text shengri = Text21.Text xueli = Text23.Text zhuanye = Text24.Text bumen = Text25.Text zhiwu = Text26.Text gongling = Text27.Text '把输入文本框的数据付给变量 If xingming <> "" Then where = where & "AND xingming = '" & xingming & "'" End If If xingbie <> "" Then where = where & "AND xingbie = '" & xingbie & "'" End If If jiguan <> "" Then where = where & "AND jiguan = '" & jiguan & "'" End If If shengri <> "" Then where = where & "AND shengri = '" & shengri & "'" End If If xueli <> "" Then where = where & "AND xueli = '" & xueli & "'" End If If zhuanye <> "" Then where = where & "AND zhuanye = '" & zhuanye & "'" End If If bumen <> "" Then where = where & "AND bumen = '" & bumen & "'" End If If zhiwu <> "" Then where = where & "AND zhiwu = '" & zhiwu & "'" End If If gongling <> "" Then where = where & "AND gongling = '" & gongling & "'" End If '以上代码是为了表示把xingming,xingbie,jiguan等几个变量用布尔表达式来连接,然后把查询数据库的条件之一存在于where 中。 '数据库连接与打开操作 Dim conn As New ADODB.Connection Dim rs As New ADODB.Recordset Dim connstr As String connstr = "provider=microsoft.jet.oledb.4.0;data source=shujuku.mdb" Dim sql As String If where = "" Then sql = "delete * from 员工信息" conn.Open (connstr) rs.Open sql, conn, 3, 3 rs.Close conn.Close '以上代码表示,如果WHERE为空,表示页面上没有输入删除条件,则把表中所有记录都删除 Else where = Mid(shere, 5, Len(where)) '去掉WHERE前面的AND conn.Open (connstr) sql = " delete * from 员工信息 where " & where rs.Open sql, conn, 3, 3 End If MsgBox "记录删除成功!", vbOKOnly, "提示" MSFlexGrid1.Visible = False Command5.Visible = False Exit Sub End Sub 运行提示错误,实时错误‘-2147217900 (80040e14)’ where字句语法错误,错误指向rs.Open sql, conn, 3, 3 总是改不对,请各位高手帮忙!谢谢! 问题补充:这是一个查询出来记录再删除的窗体,查询没问题,就是删除出错,
▼优质解答
答案和解析
else 后面的where = Mid(shere, 5, Len(where)) 改为where = Mid(where, 5, Len(where))就可以了!
看了急!vb实时错误‘-21472...的网友还看了以下:
MicrosoftJETDatabaseEngine错误'80040e14'INSERTINTO语 2020-04-27 …
下图为四中不同细胞的比较结果,正确的是选项\t细胞\t细胞壁光合作用\t染色质A\t蓝藻细胞\t有 2020-05-14 …
Matlab程序:错误在哪里建立函数文件fun5.mfunction dy=fun5(t,y)dy 2020-05-16 …
如果f(t)=t/(1+t),g(t)=t/(1-t),证明:证明:f(t)-g(t)=-2g(t 2020-05-23 …
讨论:关于如何求卷积x(t)*h(-t)的积分表达式?以前信号与系统里学过了x(t)*h(t)的表 2020-06-06 …
已知f(x-1)=x^2-4x,求函数f(x),f(2x+1)的解析式令t=x-1,则有:x=t+ 2020-06-17 …
simulink中的s函数我用simulink搭建了一个模块,用到了s函数,用来实现以下功能:对于 2020-07-23 …
x=t+1/t,y=t-1/t化成普通方程x=t+1/t,y=t-1/t(t为参数),化成x=t+ 2020-08-02 …
急!vb实时错误‘-2147217900(80040e14)’where字句语法错误PrivateS 2020-11-01 …
VB中实时错误‘-2147217900(80040e14)’是什么意思?如题! 2021-02-01 …