Syntax Error on INSERT into User Table in MS Access 2003

前端 未结 1 1165
臣服心动
臣服心动 2020-12-12 03:21

Using VB.NET with ASP.NET and and ms-access 2003 data, I\'m trying to input data from a web form to the a table in db.mdb called \'USER\'.

I tried this code:

相关标签:
1条回答
  • 2020-12-12 03:46

    User and Password are reserved keywords. Change the names, or use square brackets around the names in the query:

        Dim cmd As OleDbCommand = New OleDbCommand("INSERT INTO [USER] (Name, Surname, Username, Country, TelNo, [Password], Address) VALUES (?, ?, ?, ?, ?, ?, ?)", conn)
    

    Then, for then next error that you will encounter: As the parameters are not named in the query, the parameter objects in the Parameters collection has to be added in the same order as they are used in the query.

    0 讨论(0)
提交回复
热议问题