if so how?
views:
2407answers:
3
A:
'Contains' does not seem to be a member of the DataRow class (maybe this is a typed data set?)
In any case, you can always use (DataTable.Select(....).Length > 0) as a substitute
Clyde
2009-05-27 19:45:33
Your right. It's a member of the DataTable class
Slim
2009-05-27 19:47:41
+1
A:
To select by a primary key you should use one of:
DataTable.Rows.Find(Object)
in case your PK is one columnDataTable.Rows.Find(Object[])
in case you have more then 1 column as a primary key
In case of a typed DataSet, the method MyDataTable.Rows.Find(...)
will be generated for you with the proper signature. Basically it is a method on DataRowCollection class
van
2009-05-27 19:53:32
A:
I assume you're referring to the DataRowCollection.Contains method ? There is an overload that takes an array of objects, you should use this one
Thomas Levesque
2009-05-27 21:30:18
I tried that, but it tells me "Expecting 2 value(s) for the key being indexed, but received 1 value(s)."
Slim
2009-05-28 19:14:08
Did you try that ? table.Contains(new object[] { valueOfFirstKey, valueOfSecondKey })
Thomas Levesque
2009-05-28 23:38:31