SubSonic 2.2. I use the repository record pattern, with a table "appointment" with an appointmentId as auto-incrementing int.
I am trying to update it, but when I do update the fields with something totally different, dirty columns are always zero, and I get an exception.
System.NullReferenceException: Object reference not set to an instance of an object. at SubSonic.DataService.ExecuteQuery(QueryCommand cmd) at SubSonic.SubSonicRepository.Update1 item, String userName) at janji.Janji.Data.DB.Update[T](RepositoryRecord1 item">T in A:\Source\VS2008\Web\Apps\janji\janji\Classes\DAL\AllStructs.vb:line 197 at janji.WebForm4.SaveData() in A:\Source\VS2008\Web\Apps\janji\janji\UI\Appt.aspx.vb:line 343
Here's my code:
        Try
        If Appointment.AppointmentId > 0 Then
            Appointment.AddressName = uxHotel.Text
            Appointment.Address = uxAddress.Text
            Appointment.AppStartTime = Date.Parse(uxApptDate.SelectedDate.Value.ToShortDateString + " " + uxApptStartTime.SelectedDate.Value.ToShortTimeString)
            Appointment.ApptEndTime = Date.Parse(uxApptDate.SelectedDate.Value.ToShortDateString + " " + uxApptEndTime.SelectedDate.Value.ToShortTimeString)
            Appointment.Completed = uxCOmpleted.Checked
            Appointment.DropNumber = uxDropNum.Text
            Appointment.Total = 0
            Appointment.EmployeeId = 0
            Appointment.Model = uxModel.Text
            Appointment.DropAmount = Decimal.Parse(uxDropAmount.SelectedValue)
            Appointment.RoomNumber = uxRoom.Text
            'If Appointment.DirtyColumns.Count > 0 Then
            Janji.Data.DB.Update(Of Janji.Data.Appointment)(Appointment)
            'End If
        End If
    Catch ex As Exception
        _ErrorMessage = ex.ToString
        RetVal = False
        lErrors.Text = _ErrorMessage
        lErrors.Visible = True
    End Try