#include "stdafx.h"
using namespace System;
using namespace System::Data;
void main()
{
DataSet^ myDataSet = gcnew DataSet("GData");
myDataSet->ReadXml("schema.xml");
DataTable^ playerTable = myDataSet->Tables["Player"];
for ( int i = 0; i < playerTable->Rows->Count; i++ )
Console::WriteLine("Player {0}: {1} {2}",i, playerTable->Rows[i]["First_Name"],playerTable->Rows[i]["Last_Name"]);
DataViewSetting^ viewSettings = myDataSet->DefaultViewManager->DataViewSettings["Player"];
viewSettings->RowFilter = "Last_Name='F'";
viewSettings->Sort = "First_Name DESC";
Console::WriteLine();
Console::WriteLine("{0} rows in the view",playerTable->DefaultView->Count);
for ( int i = 0; i < playerTable->DefaultView->Count; i++ )
Console::WriteLine("Player {0}: {1} {2}", i,
playerTable->DefaultView[i]["First_Name"],
playerTable->DefaultView[i]["Last_Name"]);
}
|