SQL Access INSERT INTO失败 [英] SQL Access INSERT INTO fails

查看:93
本文介绍了SQL Access INSERT INTO失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试制作一个视觉基本应用程序,该应用程序使用OLEDB连接到Microsoft Access数据库.在数据库内部,我的用户表具有以下布局

I'm trying to make a visual basic application which is connected to a Microsoft Access Database using OLEDB. Inside my database I have a user table with the following layout

ID - Autonumber
Username - Text
Password - Text
Email - Text

要向表中插入数据,请使用以下查询

To insert data into the table I use the following query

INSERT INTO Users (Username, Password, Email) 
VALUES ('004606', 'Password', 'Email@Mail.com')

但是我似乎在此声明中遇到了错误,根据VB,这是一个语法错误.

However I seem to get an error with this statement and according to VB it's a syntax error.

但是后来我尝试使用以下查询

But then I tried to use the following query

INSERT INTO Users (Username) Values ('004606')

此查询似乎完全正常...

This query seemed to work absolutely fine...

所以问题是我只能插入一个字段,但不能全部插入3个字段(不包括ID字段,因为它是一个自动编号).

So the problem is I can insert into just one field but not all 3 (excluding the ID field because it's an autonumber).

任何帮助将不胜感激,谢谢

Any help would be appreciated, Thanks

推荐答案

密码是保留的单词,并且必须放在方括号[password]

Password is a reserved word and must be bracketed [password]

INSERT INTO Users (Username, [Password], Email)
VALUES ('004606', 'Password', 'Email@Mail.com')

这篇关于SQL Access INSERT INTO失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆