Date: 10/13/06 (C Sharp) Keywords: database, sql Yes, I'm beating my same dead horse, of course. Now, I'm really confused. But at least my confusion is limited to a single control this time. C# 2005 standard, Windows XP Pro, tied to a SQL Server 2000 database. private void cboName_SelectedIndexChanged(object sender, EventArgs e) { try { bsRate.Filter = "prov_id = " + txtProvNo.Text; bsRate.Sort = "mexp desc"; bsRate.ResetBindings(false); MessageBox.Show("Filter = " + bsRate.Filter.ToString() + " Sort = " + bsRate.Sort.ToString()); } catch (Exception ex) { } finally { } } (It's in the try block to prevent the program from throwing an exception when the form is closed.) Now, to show you what it's doing, I actually have to show you a piece of the table itself. Like I said, this is right weird. 68267 Adams County Hospital 62578 Bellevue Hospital 4628 Belmont Pines Hospital Adams, being the first one on the list, is what pops in by default. Each of these contains one entry in the table. When I try to switch to Bellevue Hospital, this is what happens: 1. Messagebox shows prov_id 68267, combobox shows Adams County Hospital. 2. Messagebox shows prov_id 68267, combobox shows Bellevue Hospital. 3. Messagebox shows prov_id 68267, combobox is blank. 4. Messagebox shows prov_id 62578, combobox shows Belmont Pines Hospital. 5. Messagebox shows prov_id 62578, combobox is blank. 6. Messagebox shows prov_id 4628, combobox shows Belmont Pines Hospital. 7. When I check the dropdown list in the combobox again, Adams County Hospital has disappeared and Bellevue Hospital is in the dropdown list twice. There is no change to the underlying table. I assume this behavior is not normal, especially since I'm not even getting the name I'm selecting in the textbox. Has anyone seen anything like this, and can you tell me why it's happening? And, preferably, how to fix it? * * * Variations: 1. When I put the MessageBox command in the finally clause instead of the try clause, I get the same result. 2. When I take out the try/catch clause altogether, again, the same thing happens. 3. It makes no difference whether the ResetBindings command is commented out or not. Thanks.
|