Re: Finding row by a non-primary key
- From: "Val Mazur \(MVP\)" <group51a@xxxxxxxxxxx>
- Date: Wed, 29 Jun 2005 22:40:35 -0400
Hi,
I believe Select is the best way to do it against DataTable. Using of the
DataView could be "too much" for this task. Another way is to use SELECT SQL
statement against the database
--
Val Mazur
Microsoft MVP
http://xport.mvps.org
"Kjetil" <Kjetil@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:3CF6C46C-917C-475D-A292-AA0530EEEBA8@xxxxxxxxxxxxxxxx
>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: Kjetil
- Re: Finding row by a non-primary key
- References:
- Finding row by a non-primary key
- From: Kjetil
- Finding row by a non-primary key
- Prev by Date: Re: HOW DO I EDIT A RECORD IN ADO
- Next by Date: Re: Which Error object
- Previous by thread: Finding row by a non-primary key
- Next by thread: Re: Finding row by a non-primary key
- Index(es):
Relevant Pages
|
|