0
You can use DataView (sorting is unusually quick), Find() method on it and get DataRow with syntax:
DataView[finded-row].Row
-or, field-
DataView[finded-row].Row[field]
DataView[finded-row][field]
It's quicker than Select method - it use a pointer to original row but Select() use "sequential scan" and copies the row I think. It's possible to use more than one DataView with own sorts.
0
Doesn't the DataTable.Select() method return an array of DataRow objects? The returned DataRow objects do not have a property that indicates what index/position the row is in the existing DataSet/DataTable, which is the information that I really need.
I have a Windows form that allows users to navigate, the old fashioned way, up and down a set of records using databound text boxes and combo boxes. When the user double clicks a name in the TreeView however, I want it to go to the record for the person selected, in the existing databound DataSet. I do not want to create a new DataSet. This is easily done by setting the currency manager to the position of the row in the DataTable.
0
I really don't get why can't you use somethoing like that:
myDataTable.Select(LastName, 'Doe');
Mike
0
Thank you all for the suggestions. However, they don't necessarily solve the issue that I was looking at. Essentially, I have a number of fields bound to a dataset. I also have a treeview where one can simply double click on a persons name and it should take you to the record of the person listed, while maintaining the bindings and keeping the entire dataset in tact.
What I have done to solve this problem is to sort the view on the same fields that the original dataset is sorted on. I then use the three sorted fields (Last Name, First Name, SSN) with the Find() method on the DataView. Now it returns an index that is identical to the index location in the dataset. Using that index, I simply set the CurrencyManager.Position property to that of the returned index. Whalah!
0
Use DataTable.Select() method instead.
Mike
0
Just change the selectcommand in the data adapter and add a where clause. You can adjust this clause based on your criteria. Then fill the DataSet.
e.g. "Select.....Where SSN = " + mySocialSecurityNum
-Mike