Access的數據庫,寫sql的時候莫名的出錯,郁悶。提示“FROM 子句語法錯誤”。查了資料才發現原來是我用到的user字段在Access數據庫中是一個保留字,所以這句話就會出現錯誤.解決的方法也很簡單:
select * from [user] where username='"&username&"'"
下面的列表中包含了Microsoft Jet數據庫引擎在SQL語句中使用的所有保留字。注意 跟著一星號 * 的詞是被保留的,但是當前在Microsoft Jet SQL語句的范疇內並沒有意義(例如,Level和TableID)。
A
ADD
ALL
Alphanumeric - 參閱 TEXT
ALTER
And
ANY
AS
ASC
AUTOINCREMENT - 參閱 COUNTER
Avg
B-C
Between
BINARY
BIT
BOOLEAN - 參閱 BIT
BY
BYTE
CHAR,CHARACTER - 參閱 TEXT
COLUMN
CONSTRAINT
Count
COUNTER
CREATE
CURRENCY
D
DATABASE
DATE - 參閱 DATETIME
DATETIME
DELETE
DESC
DISALLOW
DISTINCT
DISTINCTROW
DOUBLE
DROP
E-H
Eqv
EXISTS
FLOAT,FLOAT8 - 參閱 DOUBLE
FLOAT4 - 參閱 SINGLE
FOREIGN
FROM
GENERAL - 參閱 LONGBINARY
GROUP
GUID
HAVING
I
IEEEDOUBLE - 參閱 DOUBLE
IEEESINGLE - 參閱 SINGLE
IGNORE
Imp
In
IN
INDEX
INNER I
NSERT
INT,INTEGER,INTEGER4 - 參閱 LONG
INTEGER1 - 參閱 BYTE
INTEGER2 - 參閱 SHORT
INTO
Is
J-M
JOIN
KEY
LEFT
Level*
Like
LOGICAL,LOGICAL1 - 參閱 BIT
LONG
LONGBINARY
LONGTEXT
Max
MEMO - 參閱 LONGTEXT
Min
Mod
MONEY - 參閱 CURRENCY
N-P
Not
NULL
NUMBER - 參閱 DOUBLE
NUMERIC - 參閱 DOUBLE
OLEOBJECT - 參閱 LONGBINARY
On
OPTION
Or
ORDER
Outer*
OWNERACCESS
PARAMETERS
PERCENT
PIVOT
PRIMARY
PROCEDURE
Q-S
REAL - 參閱 SINGLE
REFERENCES
RIGHT
SELECT
SET
SHORT
SINGLE
SMALLINT - 參閱 SHORT
SOME
StDev
StDevP
STRING - 參閱 TEXT
Sum
T-Z
TABLE
TableID*
TEXT
TIME - 參閱 DATETIME
TIMESTAMP - 參閱 DATETIME
TOP
TRANSFORM
UNION
UNIQUE
UPDATE
VALUE
VALUES
Var
VARBINARY - 參閱 BINARY
&nbs