Forum Stats

  • 3,727,123 Users
  • 2,245,325 Discussions
  • 7,852,604 Comments

Discussions

ASP.NET Oracle.ManagedDataAccess.Client OracleDataAdapter threw Common Language Runtime Error

User_ADDTN
User_ADDTN Member Posts: 1 Green Ribbon

Hi, I am using following code and some time DataAdpter threw "Common Language Runtime detected an invalid program." Error while Adapter Fill.


 public DataSet USP_SELECT_INSERT_UPDATE_FILE(int p_GL_Code, string P_FILE_TYPE, int P_Entity_Gl_Code, string P_Ref_No, int P_File_Server_Gl_Code, string P_OverWrite, string P_File_Path, string P_File_Name, int P_PersonGlCode, string P_Action)

    {

      DataSet dsResult = new DataSet();

      OracleConnection conn = new OracleConnection();

      OracleDataAdapter adp = null;

      try

      {

        using (conn = new OracleConnection(strConnection))

        {


          OracleCommand cmd = new OracleCommand("USP_SELECT_INSERT_UPDATE_FILE", conn);

          cmd.CommandType = CommandType.StoredProcedure;

          cmd.BindByName = true;

          cmd.Parameters.Clear();

          cmd.Parameters.Add("p_GL_Code".ToUpper(), OracleDbType.Int32, p_GL_Code, ParameterDirection.Input);

          cmd.Parameters.Add("P_FILE_TYPE".ToUpper(), OracleDbType.NVarchar2, P_FILE_TYPE, ParameterDirection.Input);

          cmd.Parameters.Add("P_Entity_Gl_Code".ToUpper(), OracleDbType.Int32, P_Entity_Gl_Code, ParameterDirection.Input);

          cmd.Parameters.Add("P_Ref_No".ToUpper(), OracleDbType.NVarchar2, P_Ref_No, ParameterDirection.Input);

          cmd.Parameters.Add("P_File_Server_Gl_Code".ToUpper(), OracleDbType.Int32, P_File_Server_Gl_Code, ParameterDirection.Input);

          cmd.Parameters.Add("P_OverWrite".ToUpper(), OracleDbType.NVarchar2, P_OverWrite, ParameterDirection.Input);

          cmd.Parameters.Add("P_File_Path".ToUpper(), OracleDbType.NVarchar2, P_File_Path, ParameterDirection.Input);

          cmd.Parameters.Add("P_File_Name".ToUpper(), OracleDbType.NVarchar2, P_File_Name, ParameterDirection.Input);

          cmd.Parameters.Add("P_PersonGlCode".ToUpper(), OracleDbType.Int32, P_PersonGlCode, ParameterDirection.Input);

          cmd.Parameters.Add("P_Action".ToUpper(), OracleDbType.NVarchar2, P_Action, ParameterDirection.Input);

          cmd.Parameters.Add("C_Status".ToUpper(), OracleDbType.RefCursor, ParameterDirection.Output);

          cmd.Parameters.Add("c_Result".ToUpper(), OracleDbType.RefCursor, ParameterDirection.Output);

          cmd.CommandTimeout = intTimeOut;

          adp = new OracleDataAdapter(cmd);


          conn.Open();

          adp.Fill(dsResult); /* Some time Here Adapter give Common Language Runtime Error */

              }


      }

      catch (Exception ex)

      {

        Common_Functions.SaveErrorLogDaily("Message : " + ex.Message + " StackTrace : " + ex.StackTrace);


        throw ex;

      }

      finally

      {

        conn.Close();

        conn.Dispose();

        adp.Dispose();

      }


      return dsResult;


    }

Sign In or Register to comment.