What syntax do you use .Rows.Find with multiple key values in a DataTable?

emaduddeen

Well-known member
Joined
May 5, 2010
Messages
171
Location
Lowell, MA & Occasionally Indonesia
Programming Experience
Beginner
Hi Everyone,

Can you tell me the syntax to use .Rows.Find with multiple key values in a DataTable?

I tried this but it seems the syntax is wrong.

VB.NET:
        objCurrentDataRow = objIngredientsForFormulaDataTable.Rows.Find(pFormulaName, pIngredient)

Thanks.

Truly,
Emad
 
Find() cannot find multiple rows: it is for seraching by primary key which by definition returns one row

If you want multiple rows, use Select(), but really you should probably be doing this kind of search in a database

Also, when using Find, use the typed form of objIngredientsForFormulaDataTable.FindByFormulaNameIngredient() rather than the untyped form you have posted here
 
Back
Top