IErrorInfo.GetDescription 因 E_FAIL(0x80004005) 而失败
刚刚学习阶段一般用的数据库是Access,程序里面总是报“IErrorInfo.GetDescription 因 E_FAIL(0x80004005) 而失败。”这个错误。其实这是因为使用了Access的关键字。个人感觉写程序之前应当多看一些高人的程序。良好的编程习惯包括很多内容,而且我想数据库管理系统自动生成的语句就应该很标准了。以前在Visual Studio中访问Access也有类似错误,把字段用“[]”括起来就应该能解决。
为了方便,把Access的关键字列出来供查看(按照首字母顺序):
ADD ALL Alphanumeric ALTER AND ANY Application AS ASC Assistant AUTOINCREMENT Avg
BETWEEN BINARY BIT BOOLEAN BY BYTE
CHAR, CHARACTER COLUMN CompactDatabase CONSTRAINT Container Count COUNTER CREATE CreateDatabase CreateField CreateGroup CreateIndex Createobject CreateProperty CreateRelation CreateTableDef CreateUser CreateWorkspace CURRENCY CurrentUser
DATABASE DATE DATETIME delete DESC Description DISALLOW DISTINCT DISTINCTROW Document DOUBLE drop
Echo Else End Eqv Error EXISTS Exit
FALSE Field, Fields FillCache FLOAT, FLOAT4, FLOAT8 FOREIGN Form, Forms FROM Full FUNCTION
GENERAL Getobject GetOption GotoPage GROUP GROUP BY GUID
HAVING
Idle IEEEDOUBLE, IEEESINGLE If IGNORE Imp IN INDEX Index, Indexes INNER INSERT InsertText INT, INTEGER, INTEGER1, INTEGER2, INTEGER4 INTO IS
JOIN
KEY
LastModified LEFT Level Like LOGICAL, LOGICAL1 LONG, LONGBINARY, LONGTEXT
Macro Match Max, Min, Mod MEMO Module MONEY Move
NAME NewPassword NO Not Note NULL NUMBER, NUMERIC
object OLEobject OFF ON OpenRecordset OPTION OR ORDER Orientation Outer OWNERACCESS
Parameter PARAMETERS Partial PERCENT PIVOT PRIMARY PROCEDURE Property
Queries Query Quit
REAL Recalc Recordset REFERENCES Refresh RefreshLink RegisterDatabase Relation Repaint RepairDatabase
Report Reports Requery RIGHT
SCREEN SECTION SELECT SET SetFocus SetOption SHORT SINGLE SMALLINT SOME SQL StDev,
StDevP STRING Sum
TABLE TableDef, TableDefs TableID TEXT TIME, TIMESTAMP TOP TRANSFORM TRUE Type
UNION UNIQUE update USER
VALUE VALUES Var, VarP VARBINARY, VARCHAR
WHERE WITH Workspace
Xor
Year YES YESNO
人每天要做三件事,第一件是微笑,第二件是欢笑,第三件是大笑。