日期:2014-05-18 浏览次数:20785 次
using System.Data.OracleClient; private void Button1_Click(object sender, System.EventArgs e) { string ConnectionString="Data Source=192.16.1.20;user=hrp;password=hrp;"; OracleConnection conn=new OracleConnection(ConnectionString); try { conn.Open(); OracleCommand cmd=conn.CreateCommand(); cmd.CommandText="select * from MyTable"; OracleDataReader odr=cmd.ExecuteReader(); while(odr.Read()) { Response.Write(odr.GetOracleString(1).ToString()); } odr.Close(); } catch(Exception ee) { Response.Write(ee.Message); } finally { conn.Close(); } }