Syntax error INSERT INTO OleDB

1

I am trying to launch the following code from a button and the error in the image jumps to me:

Button code

sCmd = "INSERT INTO Vendedores (Password,Grupo) VALUES ('151515',0)"
GestionSql.Launch(sCmd)

GestionSql.Launch code: (line 55 of the error is the ExecuteNonQuery)

Public Sub Launch(ByVal value As String)
    Try
        oCommand.CommandText = value
        oCommand.CommandType = CommandType.Text
        oCommand.Connection = oConection
        oConection.Open()
        oCommand.ExecuteNonQuery()
    Catch ex As Exception
        MessageBox.Show(ex.ToString)
    End Try
    oConection.Close()
    oCommand.Dispose()
End Sub

Database: (password type short text, group type number)

I do not understand the error, with DELETE, SELECT, etc. I have no problems ...

    
asked by Adrian Hernando Solanas 02.05.2018 в 22:08
source

1 answer

1

The only problem he has is the following:

The Password field as such is a reserved word therefore place brackets [] to be able to use said field. [Password]

Asi:

sCmd = "INSERT INTO Vendedores ([Password],Grupo) VALUES ('151515',0)"

With this you will solve your problem, Greetings!

  

Reserved Words

    
answered by 02.05.2018 / 22:24
source