#include "stdafx.h"
using namespace System;
using namespace System::Data;
using namespace System::Data::Common;
using namespace System::Data::OleDb;
using namespace System::Data::SqlClient;
void main()
{
OleDbConnection^ myConnection = nullptr;
myConnection = gcnew OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Music.mdb");
myConnection->Open();
OleDbDataAdapter^ dataAdapter = gcnew OleDbDataAdapter("SELECT * FROM Music", myConnection);
DataSet^ myDataSet = gcnew DataSet();
DataTable^ newMusicTable = myDataSet->Tables->Add("New Music");
newMusicTable->Columns->Add("Title");
newMusicTable->Columns->Add("Duration");
DataTableMapping^ myMapping = dataAdapter->TableMappings->Add("Music", "New Music");
myMapping->ColumnMappings->Add("Title", "Title");
myMapping->ColumnMappings->Add("Duration", "Duration");
dataAdapter->MissingSchemaAction = MissingSchemaAction::Ignore;
dataAdapter->Fill(myDataSet, "Music");
for ( int i = 0; i < newMusicTable->Rows->Count; i++ ){
Console::WriteLine(newMusicTable->Rows[i]["Title"]);
Console::WriteLine(newMusicTable->Rows[i]["Duration"]);
}
myConnection->Close();
}