c# - Remove or Refresh DataTable -


i running issues application wrote. month calendar made out of panels/listboxes each day of month. populate listboxes using following:

private void populateeventlistboxes(int offsetnumber, int monthdays) {     string locationselected = this.locationcombobox.text.tolower();      (int = 0; <= (monthdays - 1); i++)     {         datetime dateselected = convert.todatetime(m_arraydatelabel[offsetnumber + i].text).date;          var tempcalendar = new data.dataset.vwget_calendardetailsdatatable();          switch (locationselected)         {             case "all":                 data.manager.calendardetailstableadapter.fillbydate(tempcalendar, dateselected);                 break;             default:                 data.manager.calendardetailstableadapter.fillbydatecity(tempcalendar, dateselected, locationselected);                 break;         }          foreach (data.dataset.vwget_calendardetailsrow row in tempcalendar)         {             ((listbox)m_arrayeventlistbox[offsetnumber + i]).items.add(row.name + " - " + row.statuscode);         }     } } 

i using var tempcalendar = new data.dataset.vwget_calendardetailsdatatable(); datatable because need load day events each of listboxes. data coming sql server view.

once calendar loaded, users have ability add/edit/delete items through pop-up dialog calendar details day. when dialog loads add/edit populate way:

private void searchforeventsbydate() {     switch (m_locationselected)     {         case "all":             data.manager.calendardetailstableadapter.fillbydate(datasetcalendar.vwget_calendardetails, m_dateselected);             calendardetailsbindingsource.datasource = datasetcalendar.vwget_calendardetails;             break;         default:             data.manager.calendardetailstableadapter.fillbydatecity(datasetcalendar.vwget_calendardetails, m_dateselected, m_locationselected);             calendardetailsbindingsource.datasource = datasetcalendar.vwget_calendardetails;             break;     }      refreshreprecordcount(); } 

this time when load data, using call datasetcalendar.vwget_calendardetails instead of temp memory version of datatable.

my issue coming play if follow these procedures:

  1. add new event employee
  2. delete same event added
  3. try , re-add new event employee on same day - app throws error guid present in table.

my table's primary key eventdate , employeeguid. if query sql table after delete, there no record application still thinks record still exists. know record in memory.

i have tried following remove memory not working:

datasetcalendar.vwget_calendardetails.findbyemployeeguid(selectedcalendarevent.employeeguid).delete(); datasetcalendar.vwget_calendardetails.acceptchanges(); 

i have tried using remove rid of record app still think record exists. don't know else or try. great.

how "storing" calendar on client side? knowing lead answer. sounds have type of cache on client side.

if cache on client side, need refresh cache when change data on server side.


Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -