Re: Efficient local data-handling

Tech-Archive recommends: Fix windows errors by optimizing your registry



You don't. Use the DefaultView of the DataTable, or create a new DataView, to sort the data.

Mantorok wrote:
Hi

How do you sort a DataTable?

Thanks
Kev

Sort the table based on your key (test) values. While iterating via
loop, see if your current row fields match the fields of the next row.

"Mantorok" <spamthis@xxxxxxxx> wrote in message
news:cbc5da8829a458c83ce8aee8bff2@xxxxxxxxxxxxxxxxxxx

Hi all

I have a DataTable containing around 25000 rows. For each row I want
to query the entire DT to find out if potentially duplicate items
exist, problem is - this is reeeeeeaaaaal slow.

I'm using the Select method:

DataRow[] found = allClients.Select(
string.Format("ClientId <> '{0}' AND cl_sname = '{1}' AND
cl_fname = '{2}'",
row["ClientId"],
(row["cl_sname"] as string).Replace("'",
"''"),
(row["cl_fname"] as string).Replace("'",
"''")));
My question - is there a quicker way of doing this? BTW, the reason
why I'm doing this locally is because the DT is made up of data from
7 different sources.

Thanks
Kev


.



Relevant Pages

  • Re: Efficient local data-handling
    ... Sort the table based on your key values. ... While iterating via loop, ... see if your current row fields match the fields of the next row. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Efficient local data-handling
    ... How do you sort a DataTable? ... loop, see if your current row fields match the fields of the next row. ... BTW, the reason ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: help with VBA
    ... Within your loop you determine that you're at ... and know that you need to sort everything on all of the rows from 4 to this ... "indraneel" wrote: ... The first thing to do is to name the ranges you want sorted, ...
    (microsoft.public.excel.worksheet.functions)
  • Re: conciseness is power
    ... (maphash (lambda (normal words) ... (push words anagrams))) ... (loop for word = (read-line s nil) ... (loop for group in anagrams do (setf group (sort group #'string-lessp))) ...
    (comp.lang.lisp)
  • Very odd Sort problem when modifying DGV bound data
    ... I have a DGV that is bound to a DataTable that is loaded during application ... I can sort with all the columns and everything works fine. ... a method that can be invoked from a context menu that will loop through the ... Try and sort the ProductID column. ...
    (microsoft.public.dotnet.languages.csharp)