0x80040E14错误?救命!

jack9527 2004-08-03 11:51:22
用户权限判定:
<%
set rsconn=server.CreateObject("adodb.connection")
rsconn.open(MM_conn_STRING)
sql="select adminnews from poweruser where powername="&Session("MM_Username")&""
set rslever=server.CreateObject("adodb.recordset")
rslever=rsconn.execute(sql)
%>
<%
if (session("admin")<>"admin") then
if (rslever("adminnews")<>1) then
response.Redirect("levererror.asp")
end if
end if
%>

请问是什么原因,有其它方法吗?c o d e
...全文
299 16 打赏 收藏 转发到动态 举报
写回复
用AI写文章
16 条回复
切换为时间正序
请发表友善的回复…
发表回复
blackxxx 2004-08-03
  • 打赏
  • 举报
回复
1看看数据类型是否匹配
2看看Session值是否传过来
jack9527 2004-08-03
  • 打赏
  • 举报
回复
是整型的
tianjy 2004-08-03
  • 打赏
  • 举报
回复
powername应该是字符串吧?
sql="select adminnews from poweruser where powername='"&Session("MM_Username")&"'"
jack9527 2004-08-03
  • 打赏
  • 举报
回复
第8行是rslever=rsconn.execute(sql)
sunboby 2004-08-03
  • 打赏
  • 举报
回复
Microsoft JET Database Engine (0x80040E14)
语法错误 (操作符丢失) 在查询表达式 'powername=' 中。
/kbt/addnews.asp, 第 8 行
出现这种情况就是,可能字段错误或是长度类型不匹配,
你好好看看
你response.write powername的值是什么
jack9527 2004-08-03
  • 打赏
  • 举报
回复
发生错误:

Microsoft JET Database Engine (0x80040E14)
语法错误 (操作符丢失) 在查询表达式 'powername=' 中。
/kbt/addnews.asp, 第 8 行
wenddy112 2004-08-03
  • 打赏
  • 举报
回复
This error is thrown up by the underlying OLEDB Provider. The actual error message is:
The command contained one or more errors
The error message that you see on the screen will vary depending on the MDAC that you have installed and the actual cause of the error.

There are a number of possible causes:
Scenario 1 - Syntax error in FROM clause
Scenario 2a - Syntax error in INSERT INTO statement
Scenario 2b - Syntax error in UPDATE statement
Scenario 3a - Syntax error (missing operator) - caused by ' mark
Scenario 3b - Syntax error (missing operator) - incorrect delimiters
Scenario 4 - Syntax error - division by zero error
Scenario 1 - Syntax error in FROM clause
This commonly occurs when you have a table name that is a reserved word or your table name contains a space (eg "table 1").

Certain words (like table, field, date, select, password, level etc) are reserved by either ADO, OLEDB or by Access for use as commands or system objects.

You can get a list of reserved words in Access from the online help. The Microsoft Platform SDK outlines ADO/OLEDB reserved words.

You should never use these words as names for tables or fields nor should you have spaces in your tablenames. It is recommended that you rename your offending tables/fields and adjust your SQL statement accordingly.

If this is not possible you should enclose your offending table names with [ ] marks, eg
SELECT field1
FROM [table]
Scenario 2a - Syntax error in INSERT INTO statement.
This commonly occurs when your field name is a reserved word (see scenario 1 above). Adjust your field names and SQL statement accordingly and you should avoid the problem.

If you can't adjust your fieldnames you can use [ ] marks to delimit the field names, eg
INSERT INTO table1
([field], [password])
VALUES ('value1', 'value2')
Scenario 2b - Syntax error in UPDATE statement.
This has the same cause as Scenario 2a immediately above.

Scenario 3a - Syntax Error (Missing Operator)
This is commonly caused when some value that you are trying to SELECT/UPDATE etc contains a single quote mark. The error that you receive looks like:
Microsoft JET Database Engine (0x80040e14)
Syntax error (missing operator) in query expression 'Name = 'O'Malleys''.
Because of the presence of the ' in the name O'Malleys the database engine thinks that you are constructing a WHERE clause like:
WHERE name = 'O'
and doesn't know what to do with the rest of the name (Malleys). To solve this problem you need to use the Replace() function and replace all single quotes with two single quotes. It is recommended that you put the Replace() function above into a user-defined function and call as necessary within your page. Click here for an example of such a function.

Scenario 3b - Syntax Error (Missing Operator) - incorrect delimiters
This error can also be caused when attempting an INSERT or UPDATE SQL statement and you have used incorrect delimiters.

Field Type (Access) Field Type (SQL Server) Delimiter
Text Char, varChar '
Numeric Any numeric type <none>
Date/Time Any Date/Time # (Access), ' (SQL Server)

UPDATE table1
SET someTextField = 'someTextValue',
someNumericField = 5
someDateField = #01/01/2000#
Scenario 4 - Division by Zero
Dates need to be delimited with # marks when passed to the Jet Database Engine. This marks them as a date literal. Access then takes the literal date and converts it into a number. Alternatively, you can pass an integer to Access, and Access will construct a date based on that number.

However if you do this:
SELECT field1
FROM table1
WHERE field1 = 01/01/00
Access will treat this as an integer - namely 1 divided by 1 divided by 0, resulting in a division by zero error. Instead you need to write your SELECT query as:
SELECT field1
FROM table1
WHERE field1 = #01/01/00#
sunboby 2004-08-03
  • 打赏
  • 举报
回复
MicrosoftOLEDBProviderforODBCDrivers(0x80040E14)-->sql语句出错(字段名错误,或数据类型不匹配)
你仔细看看吧
jack9527 2004-08-03
  • 打赏
  • 举报
回复
真的晕,ASP他妈老是出这样的错
tianjy 2004-08-03
  • 打赏
  • 举报
回复
jack9527 2004-08-03
  • 打赏
  • 举报
回复
谢谢各位了,看来只有想其它方法了
jack9527 2004-08-03
  • 打赏
  • 举报
回复
还同样的错误
sunboby 2004-08-03
  • 打赏
  • 举报
回复
我看错了,你那样写也可以
你试试我写的,
然后看看字段和数据库的是否一样
sunboby 2004-08-03
  • 打赏
  • 举报
回复
兄弟你还没解决啊,
真晕
set rsconn=server.CreateObject("adodb.connection")
rsconn.open(MM_conn_STRING)
sql="select adminnews from poweruser where powername="&Session("MM_Username")&""
set rslever=server.CreateObject("adodb.recordset")
rslever=rsconn.execute(sql)
你是在查询
应该这样
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
你看看
jack9527 2004-08-03
  • 打赏
  • 举报
回复
改成上面后就出现:错误类型:
(0x80020009)
发生意外。
/kbt/addnews.asp, 第 14 行: if (rslever("adminnews")<>1) then
aspgreener 2004-08-03
  • 打赏
  • 举报
回复
将sql改成这样试试:
sql="select adminnews from poweruser where powername='"&Session("MM_Username")&"'"

28,407

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧