#include "stdafx.h"
using namespace System;
using namespace System::Data;
void main()
{
DataSet^ myDataSet = gcnew DataSet("Game_Data");
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"]);
DataView^ myView = gcnew DataView(playerTable, "Last_Name='F'","First_Name DESC", DataViewRowState::CurrentRows);
Console::WriteLine();
Console::WriteLine("{0} rows in the view", myView->Count);
for ( int i = 0; i < myView->Count; i++ )
Console::WriteLine("Player {0}: {1} {2}", i,myView[i]["First_Name"],myView[i]["Last_Name"]);
}
|