日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程语言 > C# >内容正文

C#

[C#]关于Access的“INSERT INTO 语句的语法错误”问题

發(fā)布時間:2025/4/16 C# 36 豆豆
生活随笔 收集整理的這篇文章主要介紹了 [C#]关于Access的“INSERT INTO 语句的语法错误”问题 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

以下內(nèi)容摘自網(wǎng)上資料,具體出處已找不到,在此對原文作者表示感謝和敬意!

insert into 語句的語法錯誤經(jīng)常會出現(xiàn),主要原因是數(shù)據(jù)的字段名為access或sql數(shù)據(jù)庫的保留字

解決的方法很簡單,一是可以直接改掉那些字段名,二是在代碼中將字段名用中括號"[ ]"括起來即可..

ACCESS中寫SQL語句時盡量把表名和字段名用中括號括起來

ACCESS中寫SQL語句時盡量把表名和字段名用中括號括起來,一般都要寫成:

[TableName].FieldName,否則較長的中文名表名可能會被不識別。

當(dāng)然,要是熟悉access或sql數(shù)據(jù)庫的保留字,就不會有這樣的煩惱.以下是SQL和ACCESS保留字,供大家參考:

在開發(fā)網(wǎng)店下載專家v3.0.0時,寫入數(shù)據(jù)庫的其中一個insert into 語句總是報錯,可憐我花了一個多小時查錯卻一無所獲,真衰啊。原來是因為表中的一個字段名設(shè)為了Moduel,丫的,原來是保留字!!!

特此寫下此文,嚴(yán)重警告自己不要在范這種低級錯誤了!!

SQL和ACCESS保留字

SQL保留字?
action add aggregate all?
alter after and as?
asc avg avg_row_length auto_increment?
between bigint bit binary?
blob bool both by?
cascade case char character?
change check checksum column?
columns comment constraint create?
cross current_date current_time current_timestamp?
data database databases date?
datetime day day_hour day_minute?
day_second dayofmonth dayofweek dayofyear?
dec decimal default delayed?
delay_key_write delete desc describe?
distinct distinctrow double drop?
end else escape escaped?
enclosed enum explain exists?
fields file first float?
float4 float8 flush foreign?
from for full function?
global grant grants group?
having heap high_priority hour?
hour_minute hour_second hosts identified?
ignore in index infile?
inner insert insert_id int?
integer interval int1 int2?
int3 int4 int8 into?
if is isam join?
key keys kill last_insert_id?
leading left length like?
lines limit load local?
lock logs long longblob?
longtext low_priority max max_rows?
match mediumblob mediumtext mediumint?
middleint min_rows minute minute_second?
modify month monthname myisam?
natural numeric no not?
null on optimize option?
optionally or order outer?
outfile pack_keys partial password?
precision primary procedure process?
processlist privileges read real?
references reload regexp rename?
replace restrict returns revoke?
rlike row rows second?
select set show shutdown?
smallint soname sql_big_tables sql_big_selects?
sql_low_priority_updates sql_log_off sql_log_update sql_select_limit?
sql_small_result sql_big_result sql_warnings straight_join?
starting status string table?
tables temporary terminated text?
then time timestamp tinyblob?
tinytext tinyint trailing to?
type use using unique?
unlock unsigned update usage?
values varchar variables varying?
varbinary with write when?
where year year_month zerofill

ACCESS保留字
Microsoft Access 版本:1.0 , 1.1 , 2.0?
Microsoft Access for Windows 95, version 7.0?
Microsoft Access 97

本片文章中所列的單詞和符號是保留字,應(yīng)避免在Access字段名和變量名中使用,因為這些保留字在Access和Microsoft Jet database系統(tǒng)中有其特定的含義,如果你使用,將會出錯。
-A
ADD
ALL (2.0, 7.0, 97)
Alphanumeric
ALTER
AND
ANY (2.0, 7.0, 97)
Application
AS
ASC
Assistant
AUTOINCREMENT
Avg

-B

BETWEEN
BINARY
BIT
BOOLEAN
BY
BYTE

-C

CHAR, CHARACTER
COLUMN
CompactDatabase (2.0, 7.0, 97)
CONSTRAINT
Container (2.0, 7.0, 97)
Count
COUNTER (2.0, 7.0, 97)
CREATE
CreateDatabase (2.0, 7.0, 97)
CreateField (2.0, 7.0, 97)
CreateGroup (2.0, 7.0, 97)
CreateIndex (2.0, 7.0, 97)
CreateObject (2.0, 7.0, 97)
CreateProperty (2.0, 7.0, 97)
CreateRelation (2.0, 7.0, 97)
CreateTableDef (2.0, 7.0, 97)
CreateUser (2.0, 7.0, 97)
CreateWorkspace (2.0, 7.0, 97)
CURRENCY
CurrentUser (2.0, 7.0, 97)

-D

DATABASE (2.0, 7.0, 97)
DATE (2.0, 7.0, 97)
DATETIME
DELETE
DESC
Description
DISALLOW
DISTINCT
DISTINCTROW
Document (2.0, 7.0, 97)
DOUBLE (2.0, 7.0, 97)
DROP

-E
Echo (2.0, 7.0, 97)
Else
End
Eqv
Error
EXISTS (2.0, 7.0, 97)
Exit

-F

FALSE
Field, Fields (2.0, 7.0, 97)
FillCache (2.0, 7.0, 97)
FLOAT, FLOAT4, FLOAT8
FOREIGN (2.0, 7.0, 97)
Form, Forms
FROM
Full (2.0, 7.0, 97)
FUNCTION

-G

GENERAL
GetObject (2.0, 7.0, 97)
GetOption (2.0, 7.0, 97)
GotoPage
GROUP (2.0, 7.0, 97)
GROUP BY
GUID (7.0, 97)

-H

HAVING

-I[/color

Idle (2.0, 7.0, 97)
IEEEDOUBLE, IEEESINGLE
If
IGNORE (2.0, 7.0, 97)
Imp
IN, In
INDEX
Index, Indexes (2.0, 7.0, 97)
INNER
INSERT
InsertText (2.0, 7.0, 97)
INT, INTEGER, INTEGER1, INTEGER2, INTEGER4
INTO
IS, Is

-J

JOIN

-K

KEY (2.0, 7.0, 97)

-L

LEFT
Level
Like
LOGICAL, LOGICAL1
LONG, LONGBINARY, LONGTEXT

-M

Macro
Match (2.0, 7.0, 97)
Max, Min, Mod
MEMO
Module
MONEY
Move (2.0, 7.0, 97)

-N

NAME (2.0, 7.0, 97)
NewPassword (2.0, 7.0, 97)
NO
Not
NULL
NUMBER, NUMERIC

-O

Object (2.0, 7.0, 97)
OLEOBJECT (2.0, 7.0, 97)
OFF
ON
OpenRecordset (2.0, 7.0, 97)
OPTION
OR, Or
ORDER
Outer (2.0, 7.0, 97)
OWNERACCESS

-P

Parameter (2.0, 7.0, 97)
PARAMETERS
Partial (2.0, 7.0, 97)
PERCENT (2.0, 7.0, 97)
PIVOT
PRIMARY
PROCEDURE
Property (2.0, 7.0, 97)

-Q

Queries
Query
Quit (2.0, 7.0, 97)

-R

REAL
Recalc (2.0, 7.0, 97)
Recordset (2.0, 7.0, 97)
REFERENCES
Refresh
RefreshLink (2.0, 7.0, 97)
RegisterDatabase (2.0, 7.0, 97)
Relation (2.0, 7.0, 97)
Repaint (2.0, 7.0, 97)
RepairDatabase (2.0, 7.0, 97)
Report
Reports
Requery
RIGHT

-S

SCREEN
SECTION
SELECT (2.0, 7.0, 97)
SET
SetFocus (2.0, 7.0, 97)
SetOption (2.0, 7.0, 97)
SHORT
SINGLE (2.0, 7.0, 97)
SMALLINT (2.0, 7.0, 97)
SOME (2.0, 7.0, 97)
SQL
StDev, StDevP
STRING
Sum

-T

TABLE
TableDef, TableDefs (2.0, 7.0, 97)
TableID
TEXT
TIME, TIMESTAMP (2.0, 7.0, 97)
TOP (2.0, 7.0, 97)
TRANSFORM
TRUE
Type

-U

UNION
UNIQUE
UPDATE

-V

VALUE
VALUES (2.0, 7.0, 97)
Var, VarP
VARBINARY, VARCHAR (2.0, 7.0, 97)

-W

WHERE
WITH
Workspace (2.0, 7.0, 97)

-X

Xor

[color=red]-Y[/color

Year
YES
YESNO (2.0, 7.0, 97)

下面的符號不能在字段的設(shè)計中使用

.
/?
* :
! #
&
-

轉(zhuǎn)載于:https://www.cnblogs.com/avin/p/7838050.html

總結(jié)

以上是生活随笔為你收集整理的[C#]关于Access的“INSERT INTO 语句的语法错误”问题的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。