c# - DataSet: Enumerator and FindById do not return equal DataRow -


The problem today in my code is weird, and I could not reproduce it yet. I am working with a typed dataset (made with designer) and I am looping all the rows in a datat.

Occasionally (!), When the returned row while searching through the primary key is not the same, it is some code for the calculator that I have written to reproduce the issue :

  foreach (Dataset 1. Datatable 1st Draw DS Datalet 1) {if (ds.DataTable1.FindById (dr.Id)! = Dr) Console .Write (dr.Id) ; }  

No line will be written in the console, because FindById always returns the same line, which is really logical. In the code of my project, in a similar dataset with some string columns, approximately 3% of the lines (always the same lines!) Do not happen, and one of the string fields is simply empty:

 Ds.DataTable1.FindById (dr.Id)! = Dr // Returns incorrect, whatever reason  

the primary key is the only primary key field, and FindById for it is a generated method, whether someone knows a little signal or even before the problem have experience? I am afraid that this is a very special case that I have created which enables this bug or feature :)

I used to calculate this calculation of the possibility of the production being done by the cast Thought about Works with typed rows of DataRow basis but I did not find anything wrong ...

Cheers Mathius

< P>

Do you type the primary key? To compare gates (and possibly other values), there is a subtle bug in the dataset, the Guid error has to be done only with certain values ​​and usually works well.

Note: When I say that there is a bug, I mean I know that a bug report has been accepted, but I do not know it has also been ok


Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -