ASP Classic SQL Query 错误信息,请正确语法
我在 URL 中传递两 (2) 个参数,并构建以下 SQL:
I am passing two (2) parameters in the URL, and building the following SQL:
mQry = "SELECT DISTINCT name FROM link3 WHERE invoice_num =" & request.querystring("num") & "AND name LIKE" & request.querystring("nam")
我收到一条错误消息:
Microsoft OLE DB Provider for Oracle 错误80040e14"
Microsoft OLE DB Provider for Oracle error '80040e14'
ORA-00933:SQL 命令未正确结束
ORA-00933: SQL command not properly ended
什么是正确的语法?
推荐答案
您需要在 LIKE 子句周围加上引号.此外,您可以考虑使用百分比进行通配符匹配
You need to put quotes around the LIKE clause. Also, you could consider using percents for wildcard matching
mQry = "SELECT DISTINCT name FROM link3 WHERE invoice_num =" & request.querystring("num") & " AND name LIKE '%" & request.querystring("nam") & "%' "
相关文章