Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Scan in ADO?
Message
De
21/09/2004 10:02:26
 
Information générale
Forum:
ASP.NET
Catégorie:
ADO.NET
Titre:
Divers
Thread ID:
00943893
Message ID:
00944532
Vues:
22
Eric,

There was a thread that I started back in January of this year ... I was curious about the different methods of finding a row in a DataTable and how they compared, speed-wise, to each other. So, I benchmarked it and was a bit surprised at the results. Thread #865460 states the question and what I wanted to compare and Message #865501 contains the benchmark results. However, the methodology that I did *not* test was using a .Find() (if you read the thread, you'll see I didn't test it because we don't set a Primary Key in our DataSets) ... so, now I'm curious as to how that compares as well.

If I can find my old benchmark test, I'll throw in a .Find() to see what I can see ... if I can't find it, then maybe someone else can try to benchmark it?

~~Bonnie



>>You "can", but you need to do something like this
>>
>>
>>for(int iRowCtr=0;iRowCtr<MyTable.Rows.Count;iRowCtr++) {
>>   DataRow Dr = myTable.Rows[iRowCtr];
>>
>
>That's the reason I asked. My first inclination was to do what you just demonstrated but after doing it I thought that a method like find() must exist that does the same thing.
>
>Anyway I opted for this:
>
>
>this.oDSBritt.Tables["britt"].PrimaryKey =
>	new DataColumn[] {this.oDSBritt.Tables["britt"].Columns["brittid"]};
>this.oBrittRow = this.oDSBritt.Tables["britt"].Rows.Find(this.cboSelect.SelectedValue);
>if ( this.oBrittRow != null )
>{
>    // And so on and so forth
>}
>
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform