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

Recommended Answers

All 2 Replies

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

Hi adatapost,

Thanks!

Your code works like a charm.

I never thought it could need quote marks.

Truly,
Emad

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.