Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
40
WinSchedule Database Demo error
posted

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?

Parents
No Data
Reply
  • 40
    posted

    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

     

     

    Dim updateCommand As OleDbCommand = New

    OleDbCommand()

    commandTextTemplate =

     

    "UPDATE {0} SET StartDateTime = ?, EndDateTime = ?, Subject = ?, OwnerKey = ? WHERE (AppointmentID = ?)"

    updateCommand.CommandText =

     

    String

    .Format(commandTextTemplate, WinScheduleMSSQLServerSupport.APPOINTMENTS_TABLE_NAME)

    updateCommand.Connection =

     

    Me

    .Connection

    updateCommand.Parameters.Add(

     

    New System.Data.OleDb.OleDbParameter("StartDateTime", System.Data.OleDb.OleDbType.DBTimeStamp, 8, "StartDateTime"

    ))

    updateCommand.Parameters.Add(

     

    New System.Data.OleDb.OleDbParameter("EndDateTime", System.Data.OleDb.OleDbType.DBTimeStamp, 8, "EndDateTime"

    ))

    updateCommand.Parameters.Add(

     

    New System.Data.OleDb.OleDbParameter("Subject", System.Data.OleDb.OleDbType.VarChar, 50, "Subject"

    ))

    updateCommand.Parameters.Add(

     

    New System.Data.OleDb.OleDbParameter("OwnerKey", System.Data.OleDb.OleDbType.VarChar, 50, "OwnerKey"

    ))

    updateCommand.Parameters.Add(

     

    New System.Data.OleDb.OleDbParameter("Original_AppointmentID", System.Data.OleDb.OleDbType.Integer, 4, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "AppointmentID", System.Data.DataRowVersion.Original, Nothing

    ))

     

     

    Me

    ._oleDbDataAdapterForAppointments.UpdateCommand = updateCommand

     

     

    ' Configure the DELETE command

     

     

    Dim deleteCommand As OleDbCommand = New

    OleDbCommand()

    commandTextTemplate =

     

    "DELETE FROM {0} WHERE (AppointmentID = ?)"

    deleteCommand.CommandText =

     

    String

    .Format(commandTextTemplate, WinScheduleMSSQLServerSupport.APPOINTMENTS_TABLE_NAME)

    deleteCommand.Connection =

     

    Me

    .Connection

    deleteCommand.Parameters.Add(

     

    New System.Data.OleDb.OleDbParameter("Original_AppointmentID", System.Data.OleDb.OleDbType.Integer, 4, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "AppointmentID", System.Data.DataRowVersion.Original, Nothing

    ))

     

     

    Me

    ._oleDbDataAdapterForAppointments.DeleteCommand = deleteCommand

Children