New Posts New Posts RSS Feed: calling stored procedure
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

calling stored procedure

 Post Reply Post Reply
Author
BillG View Drop Down
DevForce MVP
DevForce MVP
Avatar

Joined: 05-Dec-2007
Location: Monroe, MI
Posts: 233
Post Options Post Options   Quote BillG Quote  Post ReplyReply Direct Link To This Post Topic: calling stored procedure
    Posted: 04-Oct-2013 at 7:24am
i am trying to find out the syntax for calling an update or delete store procedure from within my code. Is there an easy IdeaBlade way to do this?
 
Bill
 
Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post Posted: 04-Oct-2013 at 9:30am
If you've mapped the stored procedure within the EDM Designer the appropriate procedure will be called automatically for update/delete actions on entities.  More info on that here - http://msdn.microsoft.com/en-us/library/cc716711.aspx.
 
Otherwise,  a stored procedure which returns no data can be mapped within the EDM as a "query", and DevForce will generate calling methods for it within the EntityManager.
 
If the stored procedures aren't part of your EDM, within a server-side RPC method you can work directly with either the ObjectContext or Connection to call the stored procedure.
Back to Top
BillG View Drop Down
DevForce MVP
DevForce MVP
Avatar

Joined: 05-Dec-2007
Location: Monroe, MI
Posts: 233
Post Options Post Options   Quote BillG Quote  Post ReplyReply Direct Link To This Post Posted: 04-Oct-2013 at 10:30am
what if i don't want to create a stored procedure but i just want to code a simple Delete or Update SQL statement? Is that possible?

For Example i want to run the following SQL statement

delete from benefits where categoryCd = 'AB'

i really don't want to loop through a collection to delete the above items. How can i call a delete sql query from my code?

Bill

Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post Posted: 04-Oct-2013 at 10:54am
There's nothing within DevForce to directly support this.  One option is to use ADO.NET within a server RPC method.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down