#include "pch.h" using namespace System; using namespace System::Data; using namespace Oracle::DataAccess::Client; using namespace Oracle::DataAccess::Types; /// /// 選択レコード表示開始処理 /// /// 変数名なし /// 選択レコードを選択して表示する int SelectAllRecords(void) { OracleConnection^ conn = gcnew OracleConnection( L"user id=scott;password=tiger;data source=localhost/orcl"); conn->Open(); OracleCommand^ cmd = gcnew OracleCommand(L"SELECT * FROM EmployeeDetails"); cmd->Connection = conn; OracleDataReader^ reader = cmd->ExecuteReader(); Console::WriteLine("\r\n"); Console::WriteLine("----- 全レコード表示開始 -----\r\n"); while (reader->Read()) { Console::WriteLine("EmpId:" + reader->GetValue(0)->ToString()); Console::WriteLine("EmpName:" + reader->GetValue(1)); Console::WriteLine("EmpDesgn:" + reader->GetValue(2)); Console::WriteLine("EmpSalary:" + reader->GetValue(3)->ToString() + "\r\n"); } Console::WriteLine("----- 全レコード表示終了 -----\r\n"); reader->Close(); conn->Close(); return 0; } int main(void) { SelectAllRecords(); return 0; }