ODB 错误 80040e14 ASP 经典
Posted
技术标签:
【中文标题】ODB 错误 80040e14 ASP 经典【英文标题】:ODB ERROR 80040e14 ASP CLASSIC 【发布时间】:2015-01-07 22:02:36 【问题描述】:我的代码有什么问题?一直显示这个错误信息
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[mysql][ODBC 5.2(w) Driver][mysqld-5.5.28-log]You have an error in your SQL syntax;
check the manual that corresponds to your MySQL server version for the right syntax
to use near ''' at line 1
/login/update2.asp, line 12
Line 12 Set rs = objRS.Execute(mySQL)
<%
DIM strUsername
strUsername = Request.Form("Username")
IF strUsername <> "" THEN
%>
<%
DIM mySQL, objRS
mySQL = "SELECT username, email_addr FROM medacist_user WHERE username = " & strUsername & " ' "
Set objRS = Server.CreateObject("ADODB.Connection")
objRS.Open "Provider=MSDASQL.1;Password=langas;Persist Security Info=True;User ID=mmsg;Data Source=mmsg_web"
Set rs = objRS.Execute(mySQL)
IF objRS.EOF THEN
Response.Write "<div align='center'>Sorry, that username does not exist. Please click back on your browser and enter a different username.</div>"
ELSE
%>
<form name="UpdatePassword" method="post" action="reset_form.asp">
<table>
<tr><td>Customer:</td><td>
<input type="text" name="Username" size="50" value='<%=objRS("Username")%>'>
</td></tr>
<tr><td>Password:</td><td>
<input type="text" name="Password" size="50" value='<%=objRS("Password")%>'>
</td></tr>
</table>
<input type="submit" name="Submit" value="Submit">
</form>
<%
END IF
objRS.Close
Set objRS = Nothing
%>
<%
ELSE
Response.Write "Please click back on your browser and enter your username."
END IF
%>
【问题讨论】:
这对 SQL 注入开放,提交一个包含'
字符的用户名,看看会发生什么。
@Alex K. 你的意思是 WHERE username = '" & strUsername & "'" ?
【参考方案1】:
mySQL = "SELECT username, email_addr FROM medacist_user WHERE username = '" & strUsername & " ' "
您添加了结束撇号来指定字符串,而不是开始。
【讨论】:
@Random:查看代码中为mySQL
赋值的行。将其与@pee2pee 更正的同一行进行比较,后者仅添加了 1 个字符。祝你好运。
@pee2pee 感谢你们俩的帮助!我修复了它缺少单引号。现在我在第 14 行收到另一个 ADODB.Connection 错误“800a0bb9”错误。第 14 行是 IF objRS.EOF 那么这有什么问题
Try IF rs.EOF THEN 您正在测试您的记录集是否为空,而不是您的连接对象。请接受正确的答案:-)以上是关于ODB 错误 80040e14 ASP 经典的主要内容,如果未能解决你的问题,请参考以下文章