IErrorInfo.GetDescription 因 E_FAIL(0x80004005) 而失败


Posted on August 6, 2008


在用access作为数据库的时候,出现了这样的错误信息"IErrorInfo.GetDescription 因 E_FAIL(0x80004005) 而失败"
原因是数据表里有些字段名用到了access的关键字
解决方法是把字段名用[]括起来.

为了避免大家犯同样的错误,现将Access的关键字列出来,如果以后在编程中你遇到了同样的错误,请看看是否使用了Access的关键字。
 

-A
    
ADD
    
ALL
    Alphanumeric
    
ALTER
    
AND
    
ANY
    Application
    
AS
    
ASC
    Assistant
       AT
    AUTOINCREMENT
    
Avg
-B
    
BETWEEN
    
BINARY
    
BIT
    BOOLEAN
    
BY
    BYTE
-C
    
CHARCHARACTER
    
COLUMN
    CompactDatabase
    
CONSTRAINT
    Container
    
Count
    COUNTER
    
CREATE
    CreateDatabase
    CreateField
    CreateGroup
    CreateIndex
    CreateObject
    CreateProperty
    CreateRelation
    CreateTableDef
    CreateUser
    CreateWorkspace
    CURRENCY
    CurrentUser
-D
    
DATABASE
    DATE
    
DATETIME
    
DELETE
    
DESC
    Description
    DISALLOW
    
DISTINCT
    DISTINCTROW
    Document
    
DOUBLE
    
DROP
-E
    Echo
    
Else
    
End
    Eqv
    Error
    
EXISTS
    
Exit
-F
    FALSE
    Field, Fields
    FillCache
    
FLOAT, FLOAT4, FLOAT8
    
FOREIGN
    Form, Forms
    
FROM
    
Full
    
FUNCTION
-G
    GENERAL
    GetObject
    GetOption
    GotoPage
    
GROUP
    
GROUP BY
    GUID
-H
    
HAVING
-I
    Idle
    IEEEDOUBLE, IEEESINGLE
    
If
    IGNORE
    Imp
    
IN
    
INDEX
    
Index, Indexes
    
INNER
    
INSERT
    InsertText
    
INTINTEGER, INTEGER1, INTEGER2, INTEGER4
    
INTO
    
IS
-J
    
JOIN
-K
    
KEY
-L
    LastModified
    
LEFT
    
Level
    
Like
    LOGICAL, LOGICAL1
    
LONG, LONGBINARY, LONGTEXT
                
-M
    Macro
    Match
    
MaxMin, Mod
    MEMO
    Module
    
MONEY
    Move
-N
    NAME
    NewPassword
    NO
    
Not
    Note
    
NULL
    
NUMBER, NUMERIC
-O
    Object
    OLEOBJECT
    
OFF
    
ON
    OpenRecordset
    
OPTION
    
OR
    
ORDER
    Orientation
    
Outer
    OWNERACCESS
-P
    Parameter
    PARAMETERS
    Partial
       Password
    
PERCENT
    PIVOT
    
PRIMARY
    
PROCEDURE
    Property
-Q
    Queries
    Query
    Quit
-R
    
REAL
    Recalc
    Recordset
    
REFERENCES
    Refresh
    RefreshLink
    RegisterDatabase
    Relation
    Repaint
    RepairDatabase
    Report
    Reports
    Requery
    
RIGHT
-S
    SCREEN
    SECTION
    
SELECT
    
SET
    SetFocus
    SetOption
    SHORT
    
SINGLE
        Size

    
SMALLINT
    
SOME
    SQL
    
StDevStDevP
    STRING
    
Sum
-T
    
TABLE
    TableDef, TableDefs
    TableID
    
TEXT
    TIME, 
TIMESTAMP
    
TOP
    TRANSFORM
    TRUE
    Type
-U
    
UNION
    
UNIQUE
    
UPDATE
    
USER
-V
    VALUE
    
VALUES
    
VarVarP
    
VARBINARYVARCHAR
-W
    
WHERE
    
WITH
    Workspace
-X
    Xor
-Y
    
Year
    YES
    YESNO

在Access中和在MS SQL中一样,对关键字的转义是使用“[”和“]”的,比如你的数据库中某个表中有以上述关键字作为字段名的,记得在该字段前后分别加上“[”和“]”,如[user],[password],[yes],不过建议还是尽量避免使用关键字。


标签:N/A

 

在线学习答案查询入口
微信扫码联系
微信扫码联系