Click here to Skip to main content
15,913,610 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Good Day all

Can anyone please tell me how i can create a c sharp function that will execute all my stored procedures throughout my app. i want to do it in such a way that when i need to execute a stored procedure all i do is invoke the c sharp function and pass it some parameters.

thanks
Regards
Posted
Updated 16-Feb-13 20:12pm
v2
Comments
Sandeep Mewara 17-Feb-13 1:48am    
Does not make much sense. SP's are executed once you trigger. Invoke function, trigger SP... if needed, SP inside SP..
Now what is the question?
Georges23 17-Feb-13 2:11am    
no i mean invoking stored procedures inside c sharp generic function
Georges23 17-Feb-13 2:12am    
please read the updated version of my question

It's not strictly possible to write a generic method that will "execute all my stored procedures" for the simple reason that the procedures will have different parameters which must be supplied and a generic routine will have no idea what information to pass in these parameters.

However, you can make a method for each procedure manually. If you mark it as static, it would be available throughout your app via a static MyClass.MyMethod call.
 
Share this answer
 
If "generic" here is the OO term - than the question makes no sense, since the SP not in the scope of c#.
If "generic" means "capable of handling any SP", than you might consider not struggling with this, since it would be too complex.
The approach you can see here: http://kennyshu.blogspot.hu/2008/10/generic-method-for-getting-data-from-db.html[^] is handling only one scenario of retrieving results, but you can use it to make suitable for your needs. But believe me, you will not gain much.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900