-
您的位置:首页 → 技术开发 → ASP技巧 → 关于0x80040e14错误
关于0x80040e14错误
时间:2004/11/7 4:11:00来源:本站整理作者:蓝点我要评论(0)
-
为什么我会得到一个0x80040e14的错误信息?
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
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#
相关阅读
Windows错误代码大全 Windows错误代码查询激活windows有什么用Mac QQ和Windows QQ聊天记录怎么合并 Mac QQ和Windows QQ聊天记录Windows 10自动更新怎么关闭 如何关闭Windows 10自动更新windows 10 rs4快速预览版17017下载错误问题Win10秋季创意者更新16291更新了什么 win10 16291更新内容windows10秋季创意者更新时间 windows10秋季创意者更新内容kb3150513补丁更新了什么 Windows 10补丁kb3150513是什么
-
热门文章
没有查询到任何记录。
最新文章
VB.NET 2005编写定时关
Jquery get/post下乱码解决方法 前台gbk gb如何使用数据绑定控件显示数据ASP脚本循环语句ASP怎么提速
人气排行
轻松解决"Server Application Error"和iis"一起学习DataGridView调整列宽用ASP随机生成文件名的函数Jquery get/post下乱码解决方法 前台gbk gbODBC Drivers错误80004005的解决办法返回UPDATE SQL语句所影响的行数的方法用Javascript隐藏超级链接的真实地址两个不同数据库表的分页显示解决方案
查看所有0条评论>>