Re: Datatable's Select and Compute methods
From: Miha Markic [MVP C#] (miha)
Date: 09/27/04
- Next message: MikeH: "Re: Datatable's Select and Compute methods"
- Previous message: Mark: "ODBC & OLEDB"
- In reply to: MikeH: "Re: Datatable's Select and Compute methods"
- Next in thread: Steven Cheng[MSFT]: "Re: Datatable's Select and Compute methods"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 27 Sep 2004 10:44:55 +0200
"MikeH" <MikeH@community.nospam> wrote in message
news:9D2BBAEF-D7CA-4F1F-BA30-00C89C2E07B3@microsoft.com...
> Example: A DataTable has 2 columns; KEY and COL_A. Column KEY is the
> PrimaryKey. A secondary key is also defined for COL_A. The keys are
> defined
> using the dataset designer.
>
> If I execute a SELECT method with filter: "COL_A = 'This'", will a lookup
> be
> performed using the secondary key or will every record in the table be
> searched for a match?
>
> I suspect the later which means the app will not scale well at all.
Yes, very probably Select doesn't utilize keys.
However, if you need to search values by keys, you might use use
DataTable.Rows.Find method or DataView.Find or FindRows methods.
And finally, there is a third way: create an indexing/searching mechanism by
yourself.
-- Miha Markic [MVP C#] - RightHand .NET consulting & development miha at rthand com www.rthand.com
- Next message: MikeH: "Re: Datatable's Select and Compute methods"
- Previous message: Mark: "ODBC & OLEDB"
- In reply to: MikeH: "Re: Datatable's Select and Compute methods"
- Next in thread: Steven Cheng[MSFT]: "Re: Datatable's Select and Compute methods"
- Messages sorted by: [ date ] [ thread ]