OracleConnection oc = new OracleConnection(); oc.ConnectionString = @"Data Source=gxmis;Persist Security Info=True;User ID=system;Password=admin"; try { oc.Open(); OracleCommand thisCommand = oc.CreateCommand(); thisCommand.CommandText = @"SELECT * FROM STUDENT"; OracleDataReader thisReader = thisCommand.ExecuteReader(); while (thisReader.Read()) { Console.WriteLine("\t{0} \t{1}", thisReader["student_id"], thisReader["student_name"]); } thisReader.Close(); oc.Close(); } catch (OracleException oe) { Console.WriteLine("数据库连接失败"); Console.WriteLine(oe.Message); }