public DataTable SelectPay_Unit() { string returns = ""; DataTable objDataTable = new DataTable();//定义一个DataTable try { //string connectionString = "Data Source=ORCL_201;User ID=XACXEQ_PeiXun;Password=11111;"; string connectionString = System.Configuration.ConfigurationManager.AppSettings["CoonString"].ToString();//连接字符串 OracleConnection con = new OracleConnection(connectionString); con.Open();//打开连接 OracleCommand cmd = new OracleCommand("Proc_PXUnit_Pay", con); cmd.CommandType = CommandType.StoredProcedure; OracleParameter op = new OracleParameter("cur_arg", OracleType.Cursor);//定义参数 op.Direction = ParameterDirection.Output;//设置参数类型 cmd.Parameters.Add(op); int intFieldCount = cmd.ExecuteReader(CommandBehavior.CloseConnection).FieldCount; for (int intCounter = 0; intCounter < intFieldCount; ++intCounter) { objDataTable.Columns.Add(cmd.ExecuteReader(CommandBehavior.CloseConnection).GetName(intCounter), cmd.ExecuteReader(CommandBehavior.CloseConnection).GetFieldType(intCounter)); } objDataTable.BeginLoadData(); object[] objValues = new object[intFieldCount]; while (cmd.ExecuteReader(CommandBehavior.CloseConnection).Read()) { cmd.ExecuteReader(CommandBehavior.CloseConnection).GetValues(objValues); objDataTable.LoadDataRow(objValues, true); } cmd.ExecuteReader(CommandBehavior.CloseConnection).Close(); objDataTable.EndLoadData(); //OracleConnection conn=new OracleConnection ("") // Database db = DatabaseFactory.CreateDatabase("DJG_PeiXun_ConnectionString"); //OracleCommand cmd = db.GetStoredProcCommand("Proc_PXUnit_Pay"); //db.AddInParameter(cmd,"cursor",OracleType.Cursor); //ds = db.ExecuteDataSet(cmd); } catch (Exception ex) { returns = ex.ToString(); } return objDataTable; }