Search found 1 match

by uracs
Sat 05 Nov 2011 16:33
Forum: Entity Framework support
Topic: The parameter at index 0 in the parameters array is null.
Replies: 1
Views: 3184

The parameter at index 0 in the parameters array is null.

Hi,

I am using the dotnet connector (latest version) and Visual Studio 2010 SP1
.net framework 4.0.

I generated an edmx file form an oracle database using dotnet connector.

Everything is perfect and my application is working very well.

But I tried to use a simple stored procedure.

It has one input parameter and one output parameter.

I defined in the oracle database:

Code: Select all

create or replace
PROCEDURE getnextid
( P_NEXTID OUT INTEGER
, P_TABLENAME IN VARCHAR2
) AS

--
-- Purpose: Retrives the next value from a sequence which is named
--          after table name concatented with _seq.
--          To provide for .Net Entity Framework lack of sequences
--
-- MODIFICATION HISTORY
-- Person  Date      Comments
-- ---------------------------------------------------------
-- CS      16/12/10  Created
--

--local variables---------------------------------
   --return value for the next value of the sequence
   ld_next_id  integer;
   --local variable for the in parameter table name
   ld_tablename VARCHAR2(30) := upper(P_TABLENAME);
   -- holds the sql str to be dynamically run
   ld_sql_str VARCHAR2(2000);


BEGIN

    ld_sql_str := 'SELECT '||ld_tablename||'_seq.nextval from dual';

    --dbms_output.put_line(ld_sql_str);

    EXECUTE IMMEDIATE ld_sql_str
       INTO ld_next_id;

    P_NEXTID := ld_next_id;
    
    

EXCEPTION
   WHEN OTHERS THEN
       --raise_application_error(-20101, 'There is no such sequence for this table, Please contact System Support') ;
       P_NEXTID := -1;
    
END getnextid;
I imported this into the function Imports, but when I want to use I get an error message:

The parameter at index 0 in the parameters array is null.

Code: Select all

in this part of code:

/// 
        /// No Metadata Documentation available.
        /// 
        /// No Metadata Documentation available.
        /// No Metadata Documentation available.
        public int GETNEXTID(ObjectParameter p_NEXTID, global::System.String p_TABLENAME)
        {
            ObjectParameter p_TABLENAMEParameter;
            if (p_TABLENAME != null)
            {
                p_TABLENAMEParameter = new ObjectParameter("P_TABLENAME", p_TABLENAME);
            }
            else
            {
                p_TABLENAMEParameter = new ObjectParameter("P_TABLENAME", typeof(global::System.String));
            }
    
           return base.ExecuteFunction("GETNEXTID", p_NEXTID, p_TABLENAMEParameter);
        }

this function throws the exeption:

Code: Select all

return base.ExecuteFunction("GETNEXTID", p_NEXTID, p_TABLENAMEParameter);

I did not modify anything manually I used the ADO.NET Entity Framework wizard.

Anybody can help me to resolve this problem?

Thanks advanced u.