locked
The SqlParameterCollection only accepts non-null SqlParameter type objects, not Int32 objects RRS feed

  • Question

  • User2018751277 posted

    Hello,

    Here is my code

     SqlParameter System = new SqlParameter("System", SqlDbType.VarChar, 50);

                        System .Value = strsystem;

                        spcmd.Parameters.Add(System );               

    SqlParameter OrgID = new SqlParameter("@OrgID", SqlDbType.Int);

                        OrgID.Value = IntorgId;

                        spcmd.Parameters.Add(OrgID);                 

    SqlParameter ReportID = new SqlParameter("@ReportID", SqlDbType.Int);

                        ReportID.Direction =ParameterDirection.Output;

                        spcmd.Parameters.Add(ReportId); //  Getting error on this line

    What could be the problem why i am getting this error can anyone please help me on this?

    Thanks,

    Tuesday, February 12, 2013 2:03 PM

Answers

  • User538021195 posted

    Just noticed in your last line you have ReportId with a small d - is this some other variable? It should be ReportID.

    spcmd.Parameters.Add(ReportID); //  ReportID

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, February 12, 2013 3:28 PM

All replies

  • User538021195 posted

    Just noticed in your last line you have ReportId with a small d - is this some other variable? It should be ReportID.

    spcmd.Parameters.Add(ReportID); //  ReportID

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, February 12, 2013 3:28 PM
  • User2018751277 posted

    Yes its a different variable.. now i changed it to ReportID its working perfectly..

    Thank you so much

    Tuesday, February 12, 2013 3:53 PM