Οι Ομάδες Google δεν υποστηρίζουν πλέον νέες αναρτήσεις ή εγγραφές στο Usenet. Το ιστορικό περιεχόμενο παραμένει ορατό.

Typed DataView?

13 προβολές
Παράβλεψη και μετάβαση στο πρώτο μη αναγνωσμένο μήνυμα

Greg Gates

μη αναγνωσμένη,
24 Απρ 2002, 2:01:12 μ.μ.24/4/02
ως
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

μη αναγνωσμένη,
24 Απρ 2002, 4:49:06 μ.μ.24/4/02
ως
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 νέα μηνύματα