Hi Everyone,

Can you tell me how to change this code so the value in my DatePicker control will update to the database in this update statement?

strAttendanceUpdateStatement = _
                    "UPDATE Attendance " & _
                       "SET DateOfClass = " & DatePickerDateOfClass.Value & ", " & _
                           "Absent = " & CheckBoxAbsent.Checked & " " & _
                     "WHERE AttendanceID = " & intAttendanceID

                objCommand = New OleDbCommand(strAttendanceUpdateStatement, objConnection)

                MessageBox.Show(strAttendanceUpdateStatement)

The other values get updated to the database but not the date value even though I see an actual date value in the message box.

Thanks.

Truly,
Emad

strAttendanceUpdateStatement = _
                    "UPDATE Attendance " & _
                       "SET DateOfClass='" & DatePickerDateOfClass.Value & "', " & _
                           "Absent = " & CheckBoxAbsent.Checked & " " & _
                     "WHERE AttendanceID = " & intAttendanceID

Edited 6 Years Ago by __avd: n/a

Hi adatapost,

Thanks!

Your code works like a charm.

I never thought it could need quote marks.

Truly,
Emad

This question has already been answered. Start a new discussion instead.