When testing the WinSchedule Database Demo, I am able to create appointments and save them to the database with successfully. However, if I make a change to an appointment time and try to resave, I receive the following error:
"Error updating Appointments table: Incorrect syntax near 'Nothing'"
I've tried the demo on 2 different computers, one using the default Access database, and the other modified for SQL Server 2008. Both with the same error above. Is this a known problem, or something in my environment. Any suggestions?
Yes I am getting the exact same error when running on SQL 2008. Perhaps you should review the demo code.
Going by the wording of the error message, it sounds like there is bad SQL in there somewhere.
Try to modify your AppointmentID field in your database to autonumber type.
Perhaps I have oversimplified things a bit, but reducing the excess code in the following statements, I am able to get the update and delete commands to function:
' Configure the UPDATE command
OleDbCommand()
commandTextTemplate =
"UPDATE {0} SET StartDateTime = ?, EndDateTime = ?, Subject = ?, OwnerKey = ? WHERE (AppointmentID = ?)"
updateCommand.CommandText =
.Format(commandTextTemplate, WinScheduleMSSQLServerSupport.APPOINTMENTS_TABLE_NAME)
updateCommand.Connection =
.Connection
updateCommand.Parameters.Add(
))
._oleDbDataAdapterForAppointments.UpdateCommand = updateCommand
' Configure the DELETE command
"DELETE FROM {0} WHERE (AppointmentID = ?)"
deleteCommand.CommandText =
deleteCommand.Connection =
deleteCommand.Parameters.Add(
._oleDbDataAdapterForAppointments.DeleteCommand = deleteCommand