[C#] 
public void ReadMyData(string myConnString) 
{
   string mySelectQuery = "SELECT EmpNo, DeptNo FROM Emp";
   OracleConnection myConnection = new OracleConnection(myConnString);
   OracleCommand myCommand = new OracleCommand(mySelectQuery,myConnection);
   myConnection.Open();
   OracleDataReader myReader = myCommand.ExecuteReader();
   try 
   {
     while (myReader.Read()) 
    {
       Console.WriteLine(myReader.GetInt32(0) + ", " + myReader.GetInt32(1));
    }
   }
      finally 
   {
    // always call Close when done reading.
    myReader.Close();
    // always call Close when done reading.
    myConnection.Close();
 }
}

解决方案 »

  1.   

    The .NET Framework Data Provider for Oracle does not support batched SQL statements. However, it does allow you to use multiple REF CURSOR output parameters to fill a DataSet, each in its own DataTable. You must define the parameters,  them as output parameters, and indicate that they are REF CURSOR data types. Note that you will be unable to use the Update method when the OracleDataAdapter is filled from REF CURSOR parameters to a stored procedure, because Oracle does not provide the information necessary to determine what the table name and column names are when the SQL statement is executed. The following C# example assumes that you have created this stored procedure.create or replace package sp_pkg as
       type refCursorxx is ref cursor;
    procedure getdata(a1 out refCursorxx, a2 out refCursorxx);
    end;
    create or replace package body sp_pkg as
       procedure getdata(a1 in number, a2 out refCursorxx) is
       begin
          open a1 for select * from emp;
          open a2 for select * from dept;
          end getdata;
       end;
    This example demonstrates how you might obtain table and column information using the stored procedure.OracleConnection conn = new OracleConnection("Data Source=Oracle8i;Integrated Security=yes ");
    Conn.Open;
    OracleCommand cmd = conn.CreateCommand();
    cmd.CommandText = "sp_pkg.getdata";
    cmd.CommandType = CommandType.StoredProcedure;
    cmd.Parameters.Add(new OracleParameter("a1", OracleType.Cursor)).Direction = ParameterDirection.Output;
    cmd.Parameters.Add(new OracleParameter("a2", OracleType.Cursor)).Direction = ParameterDirection.Output;
    DataSet ds = new DataSet();
    OracleDataAdapter adapter = new OracleDataAdapter(cmd);
    adapter.Fill(ds);
    After using the OracleDataAdapter to perform a Fill or FillSchema operation, the DataColumn.ReadOnly property always returns false, regardless of whether a column can be updated or not, because the Oracle server does not return this information.[C#] 
    public DataSet SelectOracleSrvRows(DataSet dataset,string connection,string query) 
    {
        OracleConnection conn = new OracleConnection(connection);
        OracleDataAdapter adapter = new OracleDataAdapter();
        adapter.SelectCommand = new OracleCommand(query, conn);
        adapter.Fill(dataset);
        return dataset;
    }
      

  2.   

    9i的连接没有什么不同吧,感谢,另外,ORACLE的远程连接,属于内部光纤的那种,是写网络名还是用ORACLE的全局名来识别