SQL Access INSERT INTO Autonumber Field

Posted by KrazyKash on Stack Overflow See other posts from Stack Overflow or by KrazyKash
Published on 2012-11-23T10:56:09Z Indexed on 2012/11/23 10:59 UTC
Read the original article Hit count: 229

Filed under:
|
|
|

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 protected]')

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...

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

© Stack Overflow or respective owner

Related posts about sql

Related posts about vb.net