C # Cause of syntax errors of insert into statements

Source: Internet
Author: User

Syntax errors of insert into statements often occur, mainly because the data field name is access or the reserved word of SQL database.

The solution is simple. First, you can change the field names directly, and second, enclose the field names in brackets "[]" in the code ..

Of course, if you are familiar with the reserved words of access or SQL database, there will be no such troubles. The following are reserved words of SQL and access for your reference:

When downloading expert v3.0.0 from a development online store, one of the insert into statements written into the database always reports an error. Sorry, it took me more than an hour to check the error but I got nothing. It turns out that the name of a field in the table is set to moduel. It turns out to be a reserved word !!!

I hereby write this article to warn myself not to make such a low-level mistake !!

Reserved SQL and access words

SQL Reserved Words
Action add aggregate all
Alter after and
Asc avg avg_row_length auto_increment
Between bigint bit binary
Blob bool both
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
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
Type use using unique
Unlock unsigned update usage
Values varchar variables varying
Varbinary with write when
Where year year_month zerofill

Access Reserved Words
Microsoft Access versions: 1.0, 1.1, 2.0
Microsoft Access for Windows 95, version 7.0
Microsoft Access 97

The words and symbols listed in this article are reserved words and should be avoided in access field names and variable names, because these reserved words have specific meanings in access and Microsoft JET database systems, if you use it, an error will occur.
-
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
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)
Bytes
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)

The following symbols cannot be used in field design.

.
/
*:
! #
&
-

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.