Stored procedures Dapper-存储过程oracle不';如果有两个以上的输出参数,则返回结果
你能帮我吗。我的代码中没有结果?如果我用的是整洁的Stored procedures Dapper-存储过程oracle不';如果有两个以上的输出参数,则返回结果,stored-procedures,dapper,out-parameters,Stored Procedures,Dapper,Out Parameters,你能帮我吗。我的代码中没有结果?如果我用的是整洁的 using(var connection = new OracleConnection("User ID=TEST;Password=TEST;data source=R_TEST")) { connection.Open(); var p = new OracleDynamicParameters(); p.Add("V_IN",
using(var connection = new OracleConnection("User ID=TEST;Password=TEST;data source=R_TEST"))
{
connection.Open();
var p = new OracleDynamicParameters();
p.Add("V_IN", "123456789874");
p.Add("VO_T1", dbType: DbType.Int32, direction: ParameterDirection.Output);
p.Add("VO_T2", dbType: DbType.Varchar2, direction: ParameterDirection.Output);
p.Add("VO_T3", dbType: DbType.Int32, direction: ParameterDirection.Output);
p.Add("VO_T4", dbType: DbType.Varchar2, direction: ParameterDirection.Output);
p.Add("VO_T5", dbType: DbType.Varchar2, direction: ParameterDirection.Output);
var result = connection.Query("WS_PKG.MY_PROCEDURE", p, commandType: CommandType.StoredProcedure);
}
Byt,如果我尝试使用手动代码获得结果。使用SqlDataReader。我取得了成功
看看这个代码。我正在使用SqlDataReader:
connection.Open();
OracleCommand command = new OracleCommand("WS_PKG.GETINFOFROMNBBYIIN", connection);
command.CommandType = CommandType.StoredProcedure;
command.BindByName = true;
command.Parameters.Add("V_IN", OracleDbType.Varchar2, 25, iin, ParameterDirection.Input);
var VO_T1 = command.Parameters.Add("VO_T1", OracleDbType.Int32, 10, default(int), ParameterDirection.Output);
var VO_T2 = command.Parameters.Add("VO_T2", OracleDbType.Varchar2, 1024, default(string), ParameterDirection.Output);
var VO_T3 = command.Parameters.Add("VO_T3", OracleDbType.Int32, 10, default(int), ParameterDirection.Output);
var VO_T4 = command.Parameters.Add("VO_T4", OracleDbType.Varchar2, 1024, default(string), ParameterDirection.Output);
var VO_T5 = command.Parameters.Add("VO_T5", OracleDbType.Varchar2, 1024, default(string), ParameterDirection.Output);
command.ExecuteNonQuery();
谢谢你们的帮助。祝你们好。
我忘了添加大小变量。
请看示例代码:
enter code hereusing(var connection = new OracleConnection("User ID=TEST;Password=TEST;data source=R_TEST"))
{
connection.Open();
var p = new OracleDynamicParameters();
p.Add("V_IN", "123456789874");
p.Add("VO_T1", dbType: DbType.Int32, direction: ParameterDirection.Output, size: 1);
p.Add("VO_T2", dbType: DbType.Varchar2, direction: ParameterDirection.Output, size: 4000);
p.Add("VO_T3", dbType: DbType.Int32, direction: ParameterDirection.Output,size: 1);
p.Add("VO_T4", dbType: DbType.Varchar2, direction: ParameterDirection.Output,size: 50);
p.Add("VO_T5", dbType: DbType.Varchar2, direction: ParameterDirection.Output, size: 50);
var result = connection.Query("WS_PKG.MY_PROCEDURE", p, commandType: CommandType.StoredProcedure);
}
我们必须添加大小变量。
谢谢大家。我决定了这个问题