Hierbij nogmaals een vraag ter lering.
Daarna zal de INSERT en DELETE wel lukken door mij.
Ik probeer mijn db te updaten met de volgende code.
Iemand die de juiste formulering voor mij heeft.
Daarna zal de INSERT en DELETE wel lukken door mij.
Ik probeer mijn db te updaten met de volgende code.
Iemand die de juiste formulering voor mij heeft.
Code:
Private Sub BewerkenGegevens()
Conn.Close()
Dim strSqlUpdate As String
ds.Clear()
Try
strSqlUpdate = "Update Gegevens SET "
strSqlUpdate = strSqlUpdate & "Naam='" & txtNaam.Text = ", & "
strSqlUpdate = strSqlUpdate & "Voornaam='" & txtVoornaam.Text = ", & "
strSqlUpdate = strSqlUpdate & "Voorl='" & txtVoorl.Text = ", & "
strSqlUpdate = strSqlUpdate & "Gebdata='" & txtGebdata.Text = ", & "
strSqlUpdate = strSqlUpdate & "Gebplaats='" & txtGebplaats.Text = ", & "
strSqlUpdate = strSqlUpdate & "Adres='" & txtAdres.Text = ", & "
strSqlUpdate = strSqlUpdate & "Huisnr='" & txtHuisnr.Text = ", & "
strSqlUpdate = strSqlUpdate & "Postcode='" & txtPostcode.Text = ", & "
strSqlUpdate = strSqlUpdate & "Plaats='" & txtPlaats.Text = ", & "
strSqlUpdate = strSqlUpdate & "Telefoon='" & txtTelefoon.Text = ", & "
strSqlUpdate = strSqlUpdate & "Mobiel='" & txtMobiel.Text = ", & "
strSqlUpdate = strSqlUpdate & "School='" & txtSchool.Text = ", & "
strSqlUpdate = strSqlUpdate & "SLB='" & txtSLB.Text = ", & "
strSqlUpdate = strSqlUpdate & "TelSLB='" & txtTelSLB.Text = ", & "
strSqlUpdate = strSqlUpdate & "TelOuder1='" & txtTelOuder1.Text = ", & "
strSqlUpdate = strSqlUpdate & "TelOuder2='" & txtTelOuder2.Text = ", & "
strSqlUpdate = strSqlUpdate & " WHERE PersID = " & PersID
MsgBox(strSqlUpdate)
ds = New DataSet
da = New OleDb.OleDbDataAdapter(strSqlUpdate, Conn)
Dim cb As New OleDb.OleDbCommandBuilder(da)
da.Update(ds, "Zorgboerderij")
Catch ex As Exception
MessageBox.Show(ex.Message, "Updaten Gegevens", MessageBoxButtons.OK, MessageBoxIcon.Error)
Finally
Conn.Close()
da.Dispose()
End Try
End Sub