Search found 4 matches

by tokh
Thu 25 Jun 2009 09:32
Forum: dotConnect for Oracle
Topic: Calling Stored Procedure with scalar return value from EF
Replies: 4
Views: 4462

Thanks for your response.
We tried to call the procedure using devart Entity Developer.
Calling the procedure now works (after some minor changes in xxx.Designer.cs). But neither the input nor the output parameters are delivered.
This is the code:

Code: Select all

        public void Getnextprimarykey(string SEQUENCENAME, string NEXTID)
        {
            this.Connection.Open();
            System.Data.EntityClient.EntityCommand command = new System.Data.EntityClient.EntityCommand();
            command.CommandType = System.Data.CommandType.StoredProcedure;
[color=blue]            command.CommandText = @"DataSourceModelEntities.Getnextprimarykey";[/color]
            command.Connection = (System.Data.EntityClient.EntityConnection)this.Connection;
            global::System.Data.EntityClient.EntityParameter SEQUENCENAMEParameter = new global::System.Data.EntityClient.EntityParameter("SEQUENCENAME", System.Data.DbType.String);
            if (SEQUENCENAME != null)
                SEQUENCENAMEParameter.Value = SEQUENCENAME;
          
            command.Parameters.Add(SEQUENCENAMEParameter);
            global::System.Data.EntityClient.EntityParameter NEXTIDParameter = new global::System.Data.EntityClient.EntityParameter("NEXTID", System.Data.DbType.String);
        [color=blue]    SEQUENCENAMEParameter.Direction = System.Data.ParameterDirection.Output;[/color]
            command.Parameters.Add(NEXTIDParameter);
            command.ExecuteNonQuery();
        }
We had to change the "blue lines" :wink: to get the procedure called.

The procedure is called (we checked this within oracle), but no parameters are delivered.

Do we have to use different types for parameters or do we have to call the procedure in a different way?
by tokh
Wed 24 Jun 2009 12:53
Forum: dotConnect for Oracle
Topic: Calling Stored Procedure with scalar return value from EF
Replies: 4
Views: 4462

Calling Stored Procedure with scalar return value from EF

Hi,
we want to use sequences to get the value for the id column before calling the Create()-Method.
To get these we wrote an StoredProcedure:

Code: Select all

create or replace PROCEDURE GetNextPrimaryKey (
                              sequenceName IN VARCHAR2,
                              NEXTID OUT VARCHAR2
                              ) AS v_sequence VARCHAR2(30);
  BEGIN
    SELECT OBJECT_NAME INTO v_sequence FROM USER_OBJECTS
    WHERE OBJECT_NAME = UPPER(sequenceName) AND OBJECT_TYPE = 'SEQUENCE';
    EXECUTE IMMEDIATE 'SELECT '|| v_sequence ||'.NEXTVAL from dual' INTO NEXTID;
  END GetNextPrimaryKey; 
(To keep it simple we use varchar during our first steps)
This works fine.

We stuck when trying to call this Procedure from EF

Code: Select all

context.GETNEXTPRIMARYKEY("SEQ_ANWENDER");
We have troubles with the return value of the Procedure. Since we return a scalar value (NEXTID), EF fails?!
We also tried to create an custom object in C# with one property "NEXTID" and the correspondent mapping in edmx - this ends up with
the error message "The data reader is incompatible with the specified 'Model.PrimaryKey'. A member of the type, 'NEXTID', does not have a corresponding column in the data reader with the same name.".


So, is there a possibility to access this stored procedure with EF?

Thanks!
by tokh
Mon 18 May 2009 10:25
Forum: dotConnect for Oracle
Topic: Can not load Oracle client. Check your PATH environment vari
Replies: 24
Views: 88594

Sure that I need the _db.zip, not 10203_vista_w2k8_x86_production_client.zip?
by tokh
Fri 15 May 2009 07:14
Forum: dotConnect for Oracle
Topic: Can not load Oracle client. Check your PATH environment vari
Replies: 24
Views: 88594

I get the same error also.
I installed dotconnect for oracle and it worked fine. But now, after a reboot of my machine, the error occures.
I tried the hints of this thread, without succes.

Any ideas?