| ページ一覧 | ブログ | twitter |  書式 | 書式(表) |

MyMemoWiki

差分

ナビゲーションに移動 検索に移動
ページの作成:「==VC++.NET Express から Oracleへ接続== [VC++.NET][Oracle] *[http://otn.oracle.co.jp/tech/dotnet/index.html .NET Developer Center] *[http://otndnld.oracle.co.jp/…」
==VC++.NET Express から Oracleへ接続==
[VC++.NET][Oracle]

*[http://otn.oracle.co.jp/tech/dotnet/index.html .NET Developer Center]
*[http://otndnld.oracle.co.jp/document/products/oracle10g/101/doc_v6/win.101/B15519-01/toc.htm Data Provider for .NET開発者ガイド]
===ODP.NETの入手===
=====入手先=====
http://otn.oracle.co.jp/tech/dotnet/index.html から Oracle Data Provider for .NET 2.0 10.2.0.2.2 をダウンロードしてインストール

====VC++の設定====
プロジェクトを作成し、参照設定を行う
[[File:1272_vc_ora_01.JPG]]

*Oracle.DataAccess.Client;
*Oracle.DataAccess.Types;

====接続====
using namespace System::Diagnostics;
using namespace Oracle::DataAccess::Client;
using namespace Oracle::DataAccess::Types;
:
OracleConnection^ conn
= gcnew OracleConnection
(L"user id=****;password=****;data source=[host name]/[service name]");

conn->Open();

Debug::Print(L"Oracle Connection Opened.");

OracleCommand^ cmd = gcnew OracleCommand(L"select * from all_tables");
cmd->Connection = conn;

OracleDataReader^ reader = cmd->ExecuteReader();

String^ ret = L"";
while (reader->Read()) {
ret += "\n" + reader->GetString(1);
}

MessageBox::Show(ret);

conn->Close();

=====結果=====
[[File:1273_vc_ora_02.JPG]]

案内メニュー