SQL Access INSERT INTO失败

编程入门 行业动态 更新时间:2024-10-23 00:26:01
本文介绍了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')

但是我似乎在此声明中遇到了错误,根据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')

更多推荐

SQL Access INSERT INTO失败

本文发布于:2023-10-29 03:39:03,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1538616.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:SQL   Access   INSERT

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!