0

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

2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by emaduddeen
1
strAttendanceUpdateStatement = _
                    "UPDATE Attendance " & _
                       "SET DateOfClass='" & DatePickerDateOfClass.Value & "', " & _
                           "Absent = " & CheckBoxAbsent.Checked & " " & _
                     "WHERE AttendanceID = " & intAttendanceID

Edited by __avd: n/a

1

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.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.