Skip to content

Instantly share code, notes, and snippets.

@kiyokura
Created October 31, 2013 12:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kiyokura/7248815 to your computer and use it in GitHub Desktop.
Save kiyokura/7248815 to your computer and use it in GitHub Desktop.
ODP.NETでGlimpse.Ado OKのパターン
// Glimpse.Ado OKのパターン
// DbFactoryからConnectionをCreateするようにする
var factory = System.Data.Common.DbProviderFactories.GetFactory("Oracle.DataAccess.Client");
using (var cn = factory.CreateConnection())
{
cn.ConnectionString = "接続文字列";
cn.Open();
var cmd = cn.CreateCommand();
cmd.CommandText = "select * from hoge";
using (var dr = cmd.ExecuteReader())
{
while (dr.Read())
{
//カラム読むよ
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment