vb.net - Error Adding Data to Access Database -


i trying add new record access database. new visual basic have been searching answer this. here code far:

dim id integer = cint(idbox.text)     dim password integer = cint(passwordbox.text)     dim first string = firstname.text     dim last string = lastname.text     dim access integer = cint(accesslevel.text)      dim conn new oledbconnection("provider = microsoft.ace.oledb.12.0;data source=c:\users\tristan\documents\visual studio 2015\projects\keno\keno\users.accdb")     conn.open()     dim ds new dataset     dim da oledb.oledbdataadapter     da = new oledb.oledbdataadapter("select * users", conn)     da.fill(ds, "users")     dim cb new oledbcommandbuilder(da)     dim dsnewrow datarow      dsnewrow = ds.tables("users").newrow()     dsnewrow.item("id") = id     dsnewrow.item("first_name") = first     dsnewrow.item("last_name") = last     dsnewrow.item("password") = password     dsnewrow.item("access_level") = access      ds.tables("users").rows.add(dsnewrow)     cb.getinsertcommand()     da.update(ds, "users")     conn.close()      msgbox("user added successfully!") 

running gets error:

an unhandled exception of type system.data.oledb.oledbexception occurred in system.data.dll

additional information: syntax error in insert statement.

any appreciated!

the issue fact "password", have used column name, reserved word. identifiers used in sql code reserved words or contain special characters, e.g. spaces, must escaped. command builder doesn't default. have set quoteprefix , quotesuffix properties make so. access database, use "[" , "]" property values respectively.


Comments

Popular posts from this blog

scala - 'wrong top statement declaration' when using slick in IntelliJ -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

PySide and Qt Properties: Connecting signals from Python to QML -