Entity Framework (Telerik) call fails with ExecuteNonQuery to PostgreSQL stored procedure -


(postgresql 9.1, telerik openaccess v2.0.50727, pgadmin iii).

i'm having difficulty calling stored procedure (telerik) entity framework. exact error is:

npgsqlexception unhandled user code.

error: 42703: column "cpatient" not exist.

the telerik templated call is:

public int savedx(string cpatient, object o, object n)     {         oaparameter parametercpatient = new oaparameter();         parametercpatient.parametername = "cpatient";         parametercpatient.size = -1;         if(cpatient != null)         {             parametercpatient.value = cpatient;         }            else         {             parametercpatient.dbtype = dbtype.string;             parametercpatient.value = dbnull.value;         }          oaparameter parametero = new oaparameter();         parametero.parametername = "o";         parametero.value = o;          oaparameter parametern = new oaparameter();         parametern.parametername = "n";         parametern.value = n;          int queryresult = this.executenonquery("select * \"public\".\"g_savedx\"(cpatient, o, n)", commandtype.text, parametercpatient, parametero, parametern);          return queryresult;     } 

where executenonquery statement generates error. postgresql stored procedure is:

  function g_savedx(cpatient character varying, o view_dx, n view_dx)   returns void ... 

the postgresql function has been tested work correctly pgadmin.

so column "cpatient" coming from?? doing wrong?

tia

i never telerik entitiesmodel executenonquery work under conditions. hence suggested code of:

        using (var cxt = new nova.data.data())         {             cxt.savedx();             cxt.savechanges();         } 

where cxt.savedx() domain model name postgresql g_savedx stored procedure, fails.

my eventual workaround postgresql use npgsql directly as:

  public void savedx(view_dx dx, bool alldx = false)     {         using (var cxt = new nova.data.data())         {             string connstring = cxt.connection.connectionstring;              using (npgsqlconnection conn = new npgsqlconnection(connstring))             {                 conn.open();                 using (var cmd = conn.createcommand())                 {                     cmd.commandtext = "g_savedx";                     cmd.commandtype = commandtype.storedprocedure;                     npgsqlcommandbuilder.deriveparameters(cmd);                     cmd.parameters["groupid"].value = ....                   var rowsaffected = cmd.executenonquery();                   }             }         }     } 

when doing way, use types defined in npgsqldbtype enumeration in postgresql procedure interface. (postgresql can use composite types, npgsql not much).

it sure nice telerik executenonquery work.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -