con.Open() DA.Fill(ds, "Passwords") If Trim(txtUrl.Text) <> "" Then Dim cb As New OleDb.OleDbCommandBuilder(DA) Dim dsNewRow As DataRow dsNewRow = ds.Tables("Passwords").NewRow dsNewRow.Item("address") = txtUrl.Text dsNewRow.Item("user") = txtUserNew.Text dsNewRow.Item("pass") = txtPassNew.Text ds.Tables("Passwords").Rows.Add(dsNewRow) SQL = cb.GetInsertCommand.CommandText MsgBox("insertcommand = " & SQL) DA.Update(ds, "Passwords") MsgBox("Password saved.") Else MsgBox("Please enter a website for the username and password.") End If con.Close()
I set a breakpoint and checked the insert command.txt and this is what I found:
SQL insert command "INSERT INTO passwords (Address, User, Pass) VALUES (?, ?, ?)"
I get the error "Syntax error in INSERT INTO statement" on this line:
I also checked the values in the new datarow (dsNewRow) and found the info there however it was in the item array and not in the separate items.
Could it be that it is placing it in the wrong place or is there something else in my code I am missing?