The following code creates a data view on a typed dataset.
DataView view = new DataView(_months);
view.RowFilter = "MonthID=MIN(MonthID)";
return (short)view[0]["MonthId"];
Is there anyway I can create a typed DataView?
I would like to be able to use the syntax:
return ((MonthDataSet.MonthDataRow)view[0]).MonthId;
but of course I can't because view[0] gives me a
DataRowView object, not a DataRow object.
thanks, Greg
If you have a strongly-typed DataSet, you can use the
DataRowView object's Row property to access the corresponding
DataRow object and then case that object to the strongly-typed
row. Your code would look like this:
MonthDataSet.MonthDataRow row = (MonthDataSet.MonthDataRow)
view[0].Row;
return row.MonthId;
I hope this information proves helpful.
David Sceppa
Microsoft
This posting is provided "AS IS" with no warranties,
and confers no rights. You assume all risk for your use.
© 2002 Microsoft Corporation. All rights reserved.