In this article I will explain how to get output parameters returns by stored procedure in asp.net.
In previous posts I explained many articles relating asp.net, gridview, JQuery, SQL Server etc. Now I will explain how to get output parameters return by stored procedure in asp.net. First we will see how to write a stored procedure to return output parameters for that check this post write stored procedure to return output parameters in SQL Server. Once stored procedure designed in database write the following code in code behind to get output parameters returns by stored procedure in asp.net.
string message = String.Empty;
SqlCommand cmd = new SqlCommand("sp_userinformation", con);
cmd.Parameters.Add("@Output", SqlDbType.Char,
500);
cmd.Parameters["@Output "].Direction = ParameterDirection.Output;
message
= (string) cmd.Parameters["@Output "].Value;
|
Dim message As String = [String].Empty
Dim cmd As New SqlCommand("sp_userinformation",
con)
cmd.Parameters.Add("@Output",
SqlDbType.[Char], 500)
cmd.Parameters("@Output
").Direction = ParameterDirection.Output
message = DirectCast(cmd.Parameters("@Output
").Value, String)
|
|
If you enjoyed this post, please support the blog below. It's FREE! Get the latest Asp.net, C#.net, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email. |
|||
Subscribe by RSS
Subscribe by Email
|
|||
|
|
|
Subscribe by RSS
Subscribe by Email
0 comments :