日期:2014-05-17  浏览次数:20740 次

c#通过ref cursor返回数据集报错
       string connectionString = " User Id=lcm;Password=look2005;Data Source=CIMFA";
         OracleConnection connection = new OracleConnection(connectionString);
        OracleCommand cmd;
            try
            {
                cmd = new OracleCommand();
                connection.Open();
                cmd.Connection = connection;
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.CommandText = "get_log.print_test";
                if (cmd.Connection.State == ConnectionState.Closed)
                {
                    cmd.Connection.Open();
                }

                OracleParameter p1 = new OracleParameter("z_name", OracleType.VarChar,15);
                OracleParameter p2 = new OracleParameter("v_cur", OracleType.Cursor);
                p1.Direction = ParameterDirection.Input;
                p2.Direction = ParameterDirection.Output;
                p1.Value = "CVSU";
                cmd.Parameters.Add(p1);
                cmd.Parameters.Add(p2);
                OracleDataAdapter da = new OracleDataAdapter(cmd);
                DataSet ds = new DataSet(); 
                da.Fill(ds);
               this.dataGridView1.DataSource = ds;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                 &