Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Typed DataView?

13 views
Skip to first unread message

Greg Gates

unread,
Apr 24, 2002, 2:01:12 PM4/24/02
to
Hi everyone:

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

David Sceppa

unread,
Apr 24, 2002, 4:49:06 PM4/24/02
to
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.

0 new messages