Finding row by a non-primary key
- From: Kjetil <Kjetil@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 29 Jun 2005 07:35:06 -0700
I have a DataTable which contains a secondary unique key in addition to the
primary key. What is the best way to search for a row with a specific value
for the secondary key?
The DataRowCollection.Find method appears to apply only for the primary key.
I could create a DataView and use the Find method of the DataView, but I
guess this is wasteful since it probably requires generating a new index for
the secondary key instead of using the index already existing in the table?
I could use the Select method of the data table, but I am not to happy about
this since it requires converting the column name and key value into search
string, which is not required by the two Find methods above. Also, I am not
sure if this will use an index to locate the row?
Any advise on the best approach is very wellcome (I am using VS2003).
.
- Follow-Ups:
- Re: Finding row by a non-primary key
- From: Val Mazur \(MVP\)
- Re: Finding row by a non-primary key
- Prev by Date: Cached ADO
- Next by Date: Re: Cached ADO
- Previous by thread: Cached ADO
- Next by thread: Re: Finding row by a non-primary key
- Index(es):
Relevant Pages
|
|