G
Guest
I'm confused.
I have a listbox. The DataSource is a DataTable based on a SQL Select
Statement that includes a where clause. For example, "Select ID, FirstName,
LastName From Employees where DepartmentID = 5"
I have three controls on the same form that are bound to this datatable. So
far so good. I click through the list in the listbox, and the controls
reflect the current selected item in the listbox. (Nice!)
Ok, here's where it gets weird. If I change the departmentID to 6 for one
of the rows, that employee disappears from the list box. At first I thought
this was really cool, but when clicking on items in the list now, the
databinding is out of sync.
Let's say I changed the first employee in the list to DepartmentID =6. It
disappears from the list. If I click on the second item in the list, I see
field values for the first item. If I click on the first item on the list, I
see field values for the changed employee that is no longer in the list.
What is happening, and how do I fix it?
I have a listbox. The DataSource is a DataTable based on a SQL Select
Statement that includes a where clause. For example, "Select ID, FirstName,
LastName From Employees where DepartmentID = 5"
I have three controls on the same form that are bound to this datatable. So
far so good. I click through the list in the listbox, and the controls
reflect the current selected item in the listbox. (Nice!)
Ok, here's where it gets weird. If I change the departmentID to 6 for one
of the rows, that employee disappears from the list box. At first I thought
this was really cool, but when clicking on items in the list now, the
databinding is out of sync.
Let's say I changed the first employee in the list to DepartmentID =6. It
disappears from the list. If I click on the second item in the list, I see
field values for the first item. If I click on the first item on the list, I
see field values for the changed employee that is no longer in the list.
What is happening, and how do I fix it?