vs2012调用oracle存储过程返回输出字符串的值的问题

vs2012调用oracle存储过程返回输出字符串的值的问题,在plsql中执行存储过程是没有问题的,输出的字符串也有值,但在vs中取输出参数的值时,此字符串的值为null,但
如果输出为整数,则可以得到返回值。

贴出你的代码看看。你的参数传的对不对

OracleConnection conn = new OracleConnection(connstr);
conn.Open();
OracleCommand cmd = conn.CreateCommand();
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "proc3";
cmd.Parameters.Add("reccount", OracleDbType.Int32).Direction = ParameterDirection.Output;
cmd.Parameters.Add("name", OracleDbType.Int32).Direction = ParameterDirection.Output;
cmd.ExecuteNonQuery();
string aab = cmd.Parameters["name"].Value.ToString();

                    存储过程如下
                    create or replace procedure proc3

(
name out Varchar2,
reccount out number
)
is
begin
name := 'asd';
reccount:=9;

end;

我只要返回两个参数,做个简单的测试,但还是不行,字符串返回值为null

cmd.ExecuteNonQuery(); 只会返回影响的条数吧。。

http://stackoverflow.com/questions/3940587/calling-oracle-stored-procedure-from-c

 // Open the connection
OracleConnection connection 
    = new OracleConnection("Server=Ora; User Id=Scott; Password = tiger;");
connection.Open();

// Create a command
OracleCommand command = new OracleCommand();
command.Connection = connection;

// Set the CommandType property to execute 
// stored procedures or functions by this command
command.CommandType = System.Data.CommandType.StoredProcedure;

// Set the name of procedure or function to be executed
command.CommandText = "get_all_depts_proc";

// The ParameterCheck property should be true to automatically 
// check the parameters needed for the procedure execution.
command.ParameterCheck = true;

// At this moment, the command is ready for execution. 
// As we have an output cursor parameter, we may use the command to fill a data table.
OracleDataTable dt = new OracleDataTable(command, connection);
dt.Fill();

这个是输出参数的返回,不是要ExecuteNonQuery的返回值。

oracle 应该用的12c的 微软的oracleclient 已经过时了, 换成oracle 的 odp 就可以了 Oracle.ManagedDataAccess.dll