C
Cincy Steve
Guest
I want to create a small, sorted, strongly-typed DataTable from a strongly-typed source DataTable. The most straightforward way I know to create a sorted DataTable is to create a DataView, assign a Sort value, and convert the DataView back to a DataTable. That works fine. What doesnt work is the cast back to the original type of the source DataTable. I suspect the trip through the DataView is losing info that enables the strong typing, but I want to make sure Im not missing something. Sample code is below.
Thanks for any help you can provide. Steve
DataView dvSource = new DataView(dtSource);
dvSource.Sort = dtSource.MyColumn.ColumnName + " DESC";
MyDataSet.SourceDataTable dtSorted = (MyDataSet.SourceDataTable)dvSource.ToTable();
Continue reading...
Thanks for any help you can provide. Steve
DataView dvSource = new DataView(dtSource);
dvSource.Sort = dtSource.MyColumn.ColumnName + " DESC";
MyDataSet.SourceDataTable dtSorted = (MyDataSet.SourceDataTable)dvSource.ToTable();
Continue reading...