Print Page | Close Window

calling stored procedure

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2010
Forum Discription: For .NET 4.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=4460
Printed Date: 21-Aug-2025 at 6:38pm


Topic: calling stored procedure
Posted By: BillG
Subject: calling stored procedure
Date 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
 



Replies:
Posted By: kimj
Date 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 - 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.


Posted By: BillG
Date 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



Posted By: kimj
Date 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.



Print Page | Close Window