偷得浮生半桶水(半日闲), 好记性不如抄下来(烂笔头). 信息爆炸的时代, 学习是一项持续的工作.
全部博文(1750)
分类: Windows平台
2013-07-20 22:45:56
[TestMethod]
public void LinkOracle()
{
OracleConnection conn = new OracleConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
try
{
conn.Open();
OracleCommand cmd = conn.CreateCommand();
cmd.CommandText = "select * from newtable";
OracleDataReader odr = cmd.ExecuteReader();
while (odr.Read())
{
Console.Write(odr[0].ToString());
}
odr.Close();
}
catch (Exception ee)
{
Console.WriteLine("link error!/r/n" + ee.ToString());
}
finally
{
conn.Close();
}
}