SQL 访问 INSERT INTO 失败

编程入门 行业动态 更新时间:2024-10-22 22:50:42
本文介绍了SQL 访问 INSERT INTO 失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在尝试制作一个使用 OLEDB 连接到 Microsoft Access 数据库的 Visual Basic 应用程序.在我的数据库中,我有一个具有以下布局的用户表

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 is a reserved word and must be bracketed [password]

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

更多推荐

SQL 访问 INSERT INTO 失败

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

发布评论

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

>www.elefans.com

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