Hello,

I have the following update statement to save data to an access 2007 DB:
Code:
Public Sub opslaan2()
    Using connection As New OleDbConnection(strConnectionstring)
      Using cmdGebruiker As New OleDbCommand("UPDATE tblMEDEWERKER " & _
      "SET tblMEDEWERKER.Achternaam = @Achternaam " & _
    "WHERE tblMEDEWERKER.Medewerker_ID = @Medewerker_ID", connection)

        cmdGebruiker.Parameters.AddWithValue("@Achternaam", txtAchternaam.Text)
        cmdGebruiker.Parameters.AddWithValue("@Medewerker_ID", intMedewerker_ID)

        connection.Open()
        cmdGebruiker.ExecuteNonQuery()
        cmdGebruiker.Dispose()
      End Using
      connection.Close()
    End Using
  End Sub

This works fine!

I tried another approach:
Code:
Public Sub opslaan()
    Dim connection1 As New OleDbConnection(strConnectionstring)
    Dim cmdGebruiker As New OleDbCommand("UPDATE tblMEDEWERKER " & _
    "SET tblMEDEWERKER.Achternaam = @Achternaam " & _
  "WHERE tblMEDEWERKER.Medewerker_ID = @Medewerker_ID", connection1)

    cmdGebruiker.Parameters.AddWithValue("@Medewerker_ID", intMedewerker_ID)
    cmdGebruiker.Parameters.AddWithValue("@Achternaam", txtAchternaam.Text)
    cmdGebruiker.Parameters.AddWithValue("@Voornaam", txtVoornaam.Text)

    connection1.Open()
    cmdGebruiker.ExecuteNonQuery()
    cmdGebruiker.Dispose()
    connection1.Close()
And this one doesnt work.
Whats the difference between the 2 and why should I use "using"?

Thanks everybody