views:

980

answers:

1

Hello,

I need to find records in a dataset that have certain values from more than 1 column. I cannot use the Find or Contains method since they require a primary key and my search values can be non-unique. Do DataSets have indexes (Much like a SQL table) that I can use to speed up my search? Right now I'm looping through the dataSet doing compares for each column but this method is very very slow (my data set has 600k rows).

Thanks

+2  A: 

You can use the DataTable Select method which lets you search according to a search criteria

DataRow[] myRows = ds.Tables[0].Select("intCol=0 OR stringCol='yourSearch'");
Jhonny D. Cano -Leftware-
The select command does work but it is too slow for my DataSet, so instead I used a data view (The default). If you sort on whatever columns you're searching on the query takes a fraction of the time as with the Select method.
Dat
nice trick, i'll keep it onto account, tx
Jhonny D. Cano -Leftware-