Congratulations to all monthly winners of May 2013 !!! They have won INR 2900 cash and INR 27497 worth prize.
DotNetFunda.Com Logo
Twitter TwitterLinkedIn
YouTubeGoogle
 Online : 16479 |  Welcome, Guest!   Register  Login
 Home > Code Snippets > C# > How to: Execute a Stored Procedure using EnterPriseLibrary that Returns a Value? ...
Tripati.patro

How to: Execute a Stored Procedure using EnterPriseLibrary that Returns a Value?

 Code Snippet posted by: Tripati.patro | Posted on: 2/21/2011 | Category: C# Codes | Views: 3733 | Status: [Member] | Points: 40 | Alert Moderator   
Ads

var selectCommand = DatabaseInstance.GetStoredProcCommand("GetReturnValue");


selectCommand.Parameters.Add(new System.Data.SqlClient.SqlParameter("@anyname", DbType.Int16));
selectCommand.Parameters["anyname"].Direction = ParameterDirection.ReturnValue;

DatabaseInstance.ExecuteNonQuery(selectCommand);

var intReturnValue = Convert.ToInt64(selectCommand.Parameters["@ReturnValue"].Value);


//OR

var selectCommand = DatabaseInstance.GetStoredProcCommand("GetReturnValue");

DatabaseInstance.AddParameter(selectCommand, "anyname", DbType.Int32, ParameterDirection.ReturnValue, null, DataRowVersion.Default, null);

DatabaseInstance.ExecuteNonQuery(selectCommand);

var returnValue = Convert.ToInt32(DatabaseInstance.GetParameterValue(selectCommand, "anyname"));


B.Tripati Patro
Oracle Certified Associate
Found interesting? Add this to:


 Responses

Tripati_tutu
Posted by: Tripati_tutu | Posted on: 2/21/2011 | Level: Bronze | Status: [Member] | Points: 10 | Alert Moderator 

Good one...
Really this is helpful for us.


Thanks & Regards,
Tripati

>> Write Response - Respond to this post and get points

More codes snippets

About Us | Contact Us | The Team | Advertise | Software Development | Write for us | Testimonials | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
General Notice: If you find plagiarised (copied) contents on this page, please let us know the original source along with your correct email id (to communicate) for further action.
Copyright © DotNetFunda.Com. All Rights Reserved. Copying or mimicking the site design and layout is prohibited. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks. | 6/19/2013 7:14:13 PM