I Think I Found The Problem
- From: "Warren J. Hairston" <whairston@xxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 22 Nov 2006 01:26:12 -0500
Dave,
I think I found the problem - and it has nothing at all to do with setting
DataSource first (or last) or casting the Guid that is returned. My code was
returning the Guids properly, although I did implement the casting technique
that you suggested.
The problem is the line that reads:
DV.Sort = "JobID";
It appears that by sorting the DataView on a database Guid prior to binding,
the combo box rearranges the association between the values (the JobID
Guids) and the display members (the JobNumbers). I assume this is because
database Guids are sorted using only the last 6 bytes??? Or maybe the
DataView and the combo box are conflicting with each other by trying to sort
the data by different fields??? By looking at the debugger, it appears that
once bound to the combo box, the JobIDs are arranged in "database" order but
the JobNumbers (the DisplayMembers) are in alphabetical order -
unfortunately, this causes the wrong JobID to be associated with each
JobNumber.
Changing the line above to:
DV.Sort = "JobNumber";
resolved the problem.
When I have more time, I'll test the code with this line removed as well.
Now I'm just unsure whether this is a bug or by design. If the SQL query
that populates your DataView sorts the data on a different field than the
DisplayMember of the combo box it is later bound to, will the same problem
occur?
I'll research it more after I finish my project.
Thanks!
- Warren
.
- Follow-Ups:
- Re: I Think I Found The Problem
- From: Dave Sexton
- Re: I Think I Found The Problem
- References:
- DataView.Find not working with GUID
- From: Warren J. Hairston
- Re: DataView.Find not working with GUID
- From: Dave Sexton
- Re: DataView.Find not working with GUID
- From: Warren J. Hairston
- Re: DataView.Find not working with GUID
- From: Dave Sexton
- Re: DataView.Find not working with GUID
- From: Dave Sexton
- Re: DataView.Find not working with GUID
- From: Warren J. Hairston
- Re: DataView.Find not working with GUID
- From: Dave Sexton
- DataView.Find not working with GUID
- Prev by Date: Re: MS Access DAO -> ADO.NET Migration
- Next by Date: Re: DataView.Find not working with GUID
- Previous by thread: Re: DataView.Find not working with GUID
- Next by thread: Re: I Think I Found The Problem
- Index(es):