|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Syntax error in update
I have a simple update where I am adding new row into a database, but it errors saying syntax error in the insert into. I have almost identical code and it works fine, what am I doing wrong, it is driving me insane.Louisa Code: StrSave = "Select passwords.id, passwords.name, passwords.login, passwords.password, passwords.addedby from Passwords" SaveAdapter = New OleDb.OleDbDataAdapter(StrSave, myConnection) SaveAdapter.Fill(SaveData, "Passwords") StrMax = "Select max(ID) as MaxID from passwords" MaxAdapter = New OleDb.OleDbDataAdapter(StrMax, myConnection) MaxAdapter.Fill(MaxData, "Passwords") Dim TblSave As DataTable TblSave = SaveData.Tables("Passwords") Dim SaveRow As DataRow SaveRow = TblSave.NewRow() Dim MaxID As Integer MaxId = MaxData.Tables(0).Rows(0).Item("MaxId") + 1 SaveRow("id") = MaxID SaveRow("Name") = TxtName.Text SaveRow("Login") = TxtLogin.Text SaveRow("Password") = TxtPassword.Text SaveRow("Addedby") = "Louisa" TblSave.Rows.Add(SaveRow) Dim objCommandBuilder As New OleDb.OleDbCommandBuilder(SaveAdapter) SaveAdapter.Update(SaveData, "passwords") |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > .Net Development > Syntax error in update |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|