安装nuget包

Oracle.ManagedDataAccess.Core

注意

ParameterDirection.InputOutput 输入输出参数
参数最好指定长度
            try
            {
                var constr = GetConfig("OracleConn");
                using var con = new OracleConnection(constr);
                con.Open();

                // Call stored procedure
                var odbcCommand = con.CreateCommand();
                odbcCommand.CommandText = "SP_";
                odbcCommand.CommandType = CommandType.StoredProcedure;

                var codePara = new OracleParameter("Code", OracleDbType.Varchar2, ParameterDirection.InputOutput)
                {
                    Value = Code
                };
                var TypePara = new OracleParameter("Type", OracleDbType.NVarchar2, 20, null, ParameterDirection.Output);

                odbcCommand.Parameters.Add(codePara);
                odbcCommand.Parameters.Add(TypePara);

                odbcCommand.ExecuteNonQuery();

                Code = codePara.Value;
                Type = TypePara.Value;

                // Close and Dispose OracleConnection
                con.Close();
            }
            catch (OracleException oex)
            {
                Code = "";
                Type = "";
            }

  

相关文章:

  • 2021-11-28
  • 2021-09-19
  • 2022-12-23
  • 2022-12-23
  • 2021-06-10
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-08-13
  • 2021-10-01
  • 2021-12-19
  • 2022-12-23
  • 2021-10-27
  • 2022-12-23
相关资源
相似解决方案