how to get the current datarow of a dataset? using this code doesnt work;
Code:DataRow MyRow = dDataSet.Tables["Table1"].Rows(BindingContext(dDataSet,"Table1").Position);
Printable View
how to get the current datarow of a dataset? using this code doesnt work;
Code:DataRow MyRow = dDataSet.Tables["Table1"].Rows(BindingContext(dDataSet,"Table1").Position);
There is no "current row" unless the table is bound to a control, in which case you should use a BindingSource. You bind the table to the BindingSource and the BindingSource to the control(s). The Current property of a the BindingSource will then return a DataRowView for the selected row. You can usually use that DataRowView directly, but if you need that actual DataRow then you can get it from the Row property:The "as DataRowView" is used to cast the property value because its type is Object. That's because a BindingSource can be bound to all sorts of different lists, not just DataTables.Code:DataRowView view = myBindingSource.Current as DataRowView
DataRow row = view.Row