{"id":202842,"date":"2024-12-24T10:12:03","date_gmt":"2024-12-24T10:12:03","guid":{"rendered":"https:\/\/namso-gen.co\/blog\/how-to-get-return-value-from-stored-procedure-in-c\/"},"modified":"2024-12-24T10:12:03","modified_gmt":"2024-12-24T10:12:03","slug":"how-to-get-return-value-from-stored-procedure-in-c","status":"publish","type":"post","link":"https:\/\/namso-gen.co\/blog\/how-to-get-return-value-from-stored-procedure-in-c\/","title":{"rendered":"How to get return value from stored procedure in C#?"},"content":{"rendered":"<p>To get the return value from a stored procedure in C#, you can use the `ExecuteScalar` method of the `SqlCommand` class. The return value of a stored procedure can be set using the `RETURN` statement in SQL Server. Here is an example of how you can get the return value from a stored procedure in C#:<\/p>\n<p>&#8220;`csharp<br \/>\nusing System;<br \/>\nusing System.Data;<br \/>\nusing System.Data.SqlClient;<\/p>\n<p>class Program<br \/>\n{<br \/>\n    static void Main()<br \/>\n    {<br \/>\n        string connString = &#8220;Data Source=(local);Initial Catalog=YourDatabase;Integrated Security=True&#8221;;<br \/>\n        using (SqlConnection conn = new SqlConnection(connString))<br \/>\n        {<br \/>\n            conn.Open();<br \/>\n            using (SqlCommand cmd = new SqlCommand(&#8220;YourStoredProcedureName&#8221;, conn))<br \/>\n            {<br \/>\n                cmd.CommandType = CommandType.StoredProcedure;<\/p>\n<p>                \/\/ Add parameters if needed<br \/>\n                cmd.Parameters.AddWithValue(&#8220;@param1&#8221;, value1);<\/p>\n<p>                \/\/ Get the return value<br \/>\n                SqlParameter returnValue = new SqlParameter();<br \/>\n                returnValue.Direction = ParameterDirection.ReturnValue;<br \/>\n                cmd.Parameters.Add(returnValue);<\/p>\n<p>                cmd.ExecuteScalar();<\/p>\n<p>                \/\/ Get the return value from the stored procedure<br \/>\n                int returnVal = Convert.ToInt32(cmd.Parameters[&#8220;@returnValue&#8221;].Value);<br \/>\n                Console.WriteLine(&#8220;Return value from stored procedure: &#8221; + returnVal);<br \/>\n            }<br \/>\n        }<br \/>\n    }<br \/>\n}<br \/>\n&#8220;`<\/p>\n<p>In this example, we first create a `SqlCommand` object with the name of the stored procedure. We then add any necessary parameters to the command and create a `SqlParameter` object to capture the return value. Finally, we execute the command and retrieve the return value using `Convert.ToInt32`.<\/p>\n<p><\/p>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_62 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title \" >Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/namso-gen.co\/blog\/how-to-get-return-value-from-stored-procedure-in-c\/#FAQs\" title=\"FAQs:\">FAQs:<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/namso-gen.co\/blog\/how-to-get-return-value-from-stored-procedure-in-c\/#1_Can_I_use_ExecuteReader_instead_of_ExecuteScalar_to_get_the_return_value_from_a_stored_procedure\" title=\"1. Can I use ExecuteReader instead of ExecuteScalar to get the return value from a stored procedure?\">1. Can I use ExecuteReader instead of ExecuteScalar to get the return value from a stored procedure?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/namso-gen.co\/blog\/how-to-get-return-value-from-stored-procedure-in-c\/#2_How_can_I_handle_exceptions_when_getting_the_return_value_from_a_stored_procedure_in_C\" title=\"2. How can I handle exceptions when getting the return value from a stored procedure in C#?\">2. How can I handle exceptions when getting the return value from a stored procedure in C#?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/namso-gen.co\/blog\/how-to-get-return-value-from-stored-procedure-in-c\/#3_What_should_I_do_if_the_return_value_from_the_stored_procedure_is_not_an_integer\" title=\"3. What should I do if the return value from the stored procedure is not an integer?\">3. What should I do if the return value from the stored procedure is not an integer?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/namso-gen.co\/blog\/how-to-get-return-value-from-stored-procedure-in-c\/#4_Can_I_pass_input_parameters_to_the_stored_procedure_when_getting_the_return_value\" title=\"4. Can I pass input parameters to the stored procedure when getting the return value?\">4. Can I pass input parameters to the stored procedure when getting the return value?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/namso-gen.co\/blog\/how-to-get-return-value-from-stored-procedure-in-c\/#5_How_can_I_debug_issues_with_getting_the_return_value_from_a_stored_procedure_in_C\" title=\"5. How can I debug issues with getting the return value from a stored procedure in C#?\">5. How can I debug issues with getting the return value from a stored procedure in C#?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/namso-gen.co\/blog\/how-to-get-return-value-from-stored-procedure-in-c\/#6_Is_it_necessary_to_specify_the_CommandType_as_StoredProcedure_when_calling_a_stored_procedure_in_C\" title=\"6. Is it necessary to specify the CommandType as StoredProcedure when calling a stored procedure in C#?\">6. Is it necessary to specify the CommandType as StoredProcedure when calling a stored procedure in C#?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/namso-gen.co\/blog\/how-to-get-return-value-from-stored-procedure-in-c\/#7_Can_I_use_stored_procedures_with_Entity_Framework_in_C\" title=\"7. Can I use stored procedures with Entity Framework in C#?\">7. Can I use stored procedures with Entity Framework in C#?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/namso-gen.co\/blog\/how-to-get-return-value-from-stored-procedure-in-c\/#8_Is_it_possible_to_pass_output_parameters_from_a_stored_procedure_to_C\" title=\"8. Is it possible to pass output parameters from a stored procedure to C#?\">8. Is it possible to pass output parameters from a stored procedure to C#?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/namso-gen.co\/blog\/how-to-get-return-value-from-stored-procedure-in-c\/#9_How_can_I_call_a_stored_procedure_with_multiple_return_values_in_C\" title=\"9. How can I call a stored procedure with multiple return values in C#?\">9. How can I call a stored procedure with multiple return values in C#?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/namso-gen.co\/blog\/how-to-get-return-value-from-stored-procedure-in-c\/#10_Can_I_use_a_stored_procedure_to_perform_CRUD_operations_in_C\" title=\"10. Can I use a stored procedure to perform CRUD operations in C#?\">10. Can I use a stored procedure to perform CRUD operations in C#?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/namso-gen.co\/blog\/how-to-get-return-value-from-stored-procedure-in-c\/#11_Is_there_a_performance_benefit_to_using_stored_procedures_in_C\" title=\"11. Is there a performance benefit to using stored procedures in C#?\">11. Is there a performance benefit to using stored procedures in C#?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-13\" href=\"https:\/\/namso-gen.co\/blog\/how-to-get-return-value-from-stored-procedure-in-c\/#12_Can_I_call_a_stored_procedure_from_a_different_SQL_Server_in_C\" title=\"12. Can I call a stored procedure from a different SQL Server in C#?\">12. Can I call a stored procedure from a different SQL Server in C#?<\/a><\/li><\/ul><\/nav><\/div>\n<h3><span class=\"ez-toc-section\" id=\"FAQs\"><\/span>FAQs:<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<h3><span class=\"ez-toc-section\" id=\"1_Can_I_use_ExecuteReader_instead_of_ExecuteScalar_to_get_the_return_value_from_a_stored_procedure\"><\/span>1. Can I use ExecuteReader instead of ExecuteScalar to get the return value from a stored procedure?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>No, ExecuteReader is used to execute a query that returns a result set whereas ExecuteScalar is used to execute a query that returns a single value. To get the return value from a stored procedure, it is recommended to use ExecuteScalar.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"2_How_can_I_handle_exceptions_when_getting_the_return_value_from_a_stored_procedure_in_C\"><\/span>2. How can I handle exceptions when getting the return value from a stored procedure in C#?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>You can use a try-catch block to handle any exceptions that may occur when getting the return value. Make sure to include proper error handling to prevent any unexpected behaviors.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"3_What_should_I_do_if_the_return_value_from_the_stored_procedure_is_not_an_integer\"><\/span>3. What should I do if the return value from the stored procedure is not an integer?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>If the return value from the stored procedure is not an integer, you can use the appropriate data type when retrieving the value in C#. For example, if the return value is a string, you can use `Convert.ToString` to convert it to a string.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"4_Can_I_pass_input_parameters_to_the_stored_procedure_when_getting_the_return_value\"><\/span>4. Can I pass input parameters to the stored procedure when getting the return value?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Yes, you can pass input parameters to the stored procedure using the `Parameters.AddWithValue` method of the `SqlCommand` class. Make sure to set the parameter values before executing the command.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"5_How_can_I_debug_issues_with_getting_the_return_value_from_a_stored_procedure_in_C\"><\/span>5. How can I debug issues with getting the return value from a stored procedure in C#?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>You can use breakpoints and debugging tools in Visual Studio to step through your code and see where the issue may be occurring. Check the values of parameters and return values during debugging.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"6_Is_it_necessary_to_specify_the_CommandType_as_StoredProcedure_when_calling_a_stored_procedure_in_C\"><\/span>6. Is it necessary to specify the CommandType as StoredProcedure when calling a stored procedure in C#?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Yes, it is recommended to specify the `CommandType` as `StoredProcedure` when calling a stored procedure in C# to ensure that the command is executed as a stored procedure.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"7_Can_I_use_stored_procedures_with_Entity_Framework_in_C\"><\/span>7. Can I use stored procedures with Entity Framework in C#?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Yes, you can use stored procedures with Entity Framework in C#. Entity Framework allows you to map stored procedures to model functions and execute them as needed.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"8_Is_it_possible_to_pass_output_parameters_from_a_stored_procedure_to_C\"><\/span>8. Is it possible to pass output parameters from a stored procedure to C#?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Yes, you can pass output parameters from a stored procedure to C# by specifying the parameters as output parameters in the stored procedure and retrieving their values after executing the command.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"9_How_can_I_call_a_stored_procedure_with_multiple_return_values_in_C\"><\/span>9. How can I call a stored procedure with multiple return values in C#?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>If a stored procedure returns multiple values, you can define multiple output parameters in C# and retrieve each value individually after executing the command. Make sure to set the output parameter values correctly in the stored procedure.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"10_Can_I_use_a_stored_procedure_to_perform_CRUD_operations_in_C\"><\/span>10. Can I use a stored procedure to perform CRUD operations in C#?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Yes, you can use stored procedures to perform CRUD operations (Create, Read, Update, Delete) in C#. Stored procedures can execute SQL queries to interact with the database and manage data operations.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"11_Is_there_a_performance_benefit_to_using_stored_procedures_in_C\"><\/span>11. Is there a performance benefit to using stored procedures in C#?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Using stored procedures in C# can improve performance by reducing network traffic and optimizing SQL queries. Stored procedures are precompiled and stored in the database, making them faster to execute than ad-hoc queries.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"12_Can_I_call_a_stored_procedure_from_a_different_SQL_Server_in_C\"><\/span>12. Can I call a stored procedure from a different SQL Server in C#?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Yes, you can call a stored procedure from a different SQL Server in C# by specifying the connection string for the remote server when creating the SqlConnection object. Make sure to have proper permissions and network access to the remote server.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>To get the return value from a stored procedure in C#, you can use the `ExecuteScalar` method of the `SqlCommand` class. The return value of a stored procedure can be set using the `RETURN` statement in SQL Server. Here is an example of how you can get the return value from a stored procedure in &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"How to get return value from stored procedure in C#?\" class=\"read-more button\" href=\"https:\/\/namso-gen.co\/blog\/how-to-get-return-value-from-stored-procedure-in-c\/#more-202842\">Read more<span class=\"screen-reader-text\">How to get return value from stored procedure in C#?<\/span><\/a><\/p>\n","protected":false},"author":51,"featured_media":107420,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[86279],"tags":[],"class_list":["post-202842","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-learn","no-featured-image-padding"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to get return value from stored procedure in C#?<\/title>\n<meta name=\"description\" content=\"To get the return value from a stored procedure in C#, you can use the `ExecuteScalar` method of the `SqlCommand` class. The return value of a stored\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/namso-gen.co\/blog\/how-to-get-return-value-from-stored-procedure-in-c\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to get return value from stored procedure in C#?\" \/>\n<meta property=\"og:description\" content=\"To get the return value from a stored procedure in C#, you can use the `ExecuteScalar` method of the `SqlCommand` class. The return value of a stored\" \/>\n<meta property=\"og:url\" content=\"https:\/\/namso-gen.co\/blog\/how-to-get-return-value-from-stored-procedure-in-c\/\" \/>\n<meta property=\"og:site_name\" content=\"Namso Gen Blog - Free Credit Card Generator [100% Valid]\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/synchronyfinancial\" \/>\n<meta property=\"article:published_time\" content=\"2024-12-24T10:12:03+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/namso-gen.co\/blog\/wp-content\/uploads\/2024\/03\/faq.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"630\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Adam Forbes\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@synchrony\" \/>\n<meta name=\"twitter:site\" content=\"@synchrony\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Adam Forbes\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/namso-gen.co\/blog\/how-to-get-return-value-from-stored-procedure-in-c\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/namso-gen.co\/blog\/how-to-get-return-value-from-stored-procedure-in-c\/\"},\"author\":{\"name\":\"Adam Forbes\",\"@id\":\"https:\/\/namso-gen.co\/blog\/#\/schema\/person\/88cd882dfb29a6b147bc0ea26dc84060\"},\"headline\":\"How to get return value from stored procedure in C#?\",\"datePublished\":\"2024-12-24T10:12:03+00:00\",\"dateModified\":\"2024-12-24T10:12:03+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/namso-gen.co\/blog\/how-to-get-return-value-from-stored-procedure-in-c\/\"},\"wordCount\":784,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/namso-gen.co\/blog\/#organization\"},\"articleSection\":[\"Learn\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/namso-gen.co\/blog\/how-to-get-return-value-from-stored-procedure-in-c\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/namso-gen.co\/blog\/how-to-get-return-value-from-stored-procedure-in-c\/\",\"url\":\"https:\/\/namso-gen.co\/blog\/how-to-get-return-value-from-stored-procedure-in-c\/\",\"name\":\"How to get return value from stored procedure in C#?\",\"isPartOf\":{\"@id\":\"https:\/\/namso-gen.co\/blog\/#website\"},\"datePublished\":\"2024-12-24T10:12:03+00:00\",\"dateModified\":\"2024-12-24T10:12:03+00:00\",\"description\":\"To get the return value from a stored procedure in C#, you can use the `ExecuteScalar` method of the `SqlCommand` class. The return value of a stored\",\"breadcrumb\":{\"@id\":\"https:\/\/namso-gen.co\/blog\/how-to-get-return-value-from-stored-procedure-in-c\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/namso-gen.co\/blog\/how-to-get-return-value-from-stored-procedure-in-c\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/namso-gen.co\/blog\/how-to-get-return-value-from-stored-procedure-in-c\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/namso-gen.co\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to get return value from stored procedure in C#?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/namso-gen.co\/blog\/#website\",\"url\":\"https:\/\/namso-gen.co\/blog\/\",\"name\":\"Namso Gen Blog - Free Credit Card Generator [100% Valid]\",\"description\":\"In Namso gen blog you can get many tips regarding to Credit cards, VCC, Credit card security etc. You can generate credit cards by using Namso-gen.co\",\"publisher\":{\"@id\":\"https:\/\/namso-gen.co\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/namso-gen.co\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/namso-gen.co\/blog\/#organization\",\"name\":\"Namso Gen Blog - Free Credit Card Generator [100% Valid]\",\"url\":\"https:\/\/namso-gen.co\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/namso-gen.co\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/namso-gen.co\/blog\/wp-content\/uploads\/2020\/07\/namso-gen-logo.png\",\"contentUrl\":\"https:\/\/namso-gen.co\/blog\/wp-content\/uploads\/2020\/07\/namso-gen-logo.png\",\"width\":500,\"height\":164,\"caption\":\"Namso Gen Blog - Free Credit Card Generator [100% Valid]\"},\"image\":{\"@id\":\"https:\/\/namso-gen.co\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/synchronyfinancial\",\"https:\/\/twitter.com\/synchrony\",\"https:\/\/www.youtube.com\/synchronyfinancial\",\"https:\/\/www.instagram.com\/synchrony\",\"https:\/\/www.linkedin.com\/company\/synchrony-financial\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/namso-gen.co\/blog\/#\/schema\/person\/88cd882dfb29a6b147bc0ea26dc84060\",\"name\":\"Adam Forbes\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/namso-gen.co\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/?s=96&d=mm&r=g\",\"caption\":\"Adam Forbes\"},\"description\":\"Guest author Adam Forbes has meticulously crafted and revised this article to the best of their knowledge and understanding. Readers are strongly advised to exercise caution, verify information independently, and rely on their own judgment when considering the information provided. Read more articles on Namso Gen here.\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to get return value from stored procedure in C#?","description":"To get the return value from a stored procedure in C#, you can use the `ExecuteScalar` method of the `SqlCommand` class. The return value of a stored","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/namso-gen.co\/blog\/how-to-get-return-value-from-stored-procedure-in-c\/","og_locale":"en_US","og_type":"article","og_title":"How to get return value from stored procedure in C#?","og_description":"To get the return value from a stored procedure in C#, you can use the `ExecuteScalar` method of the `SqlCommand` class. The return value of a stored","og_url":"https:\/\/namso-gen.co\/blog\/how-to-get-return-value-from-stored-procedure-in-c\/","og_site_name":"Namso Gen Blog - Free Credit Card Generator [100% Valid]","article_publisher":"https:\/\/www.facebook.com\/synchronyfinancial","article_published_time":"2024-12-24T10:12:03+00:00","og_image":[{"width":1200,"height":630,"url":"https:\/\/namso-gen.co\/blog\/wp-content\/uploads\/2024\/03\/faq.png","type":"image\/png"}],"author":"Adam Forbes","twitter_card":"summary_large_image","twitter_creator":"@synchrony","twitter_site":"@synchrony","twitter_misc":{"Written by":"Adam Forbes","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/namso-gen.co\/blog\/how-to-get-return-value-from-stored-procedure-in-c\/#article","isPartOf":{"@id":"https:\/\/namso-gen.co\/blog\/how-to-get-return-value-from-stored-procedure-in-c\/"},"author":{"name":"Adam Forbes","@id":"https:\/\/namso-gen.co\/blog\/#\/schema\/person\/88cd882dfb29a6b147bc0ea26dc84060"},"headline":"How to get return value from stored procedure in C#?","datePublished":"2024-12-24T10:12:03+00:00","dateModified":"2024-12-24T10:12:03+00:00","mainEntityOfPage":{"@id":"https:\/\/namso-gen.co\/blog\/how-to-get-return-value-from-stored-procedure-in-c\/"},"wordCount":784,"commentCount":0,"publisher":{"@id":"https:\/\/namso-gen.co\/blog\/#organization"},"articleSection":["Learn"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/namso-gen.co\/blog\/how-to-get-return-value-from-stored-procedure-in-c\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/namso-gen.co\/blog\/how-to-get-return-value-from-stored-procedure-in-c\/","url":"https:\/\/namso-gen.co\/blog\/how-to-get-return-value-from-stored-procedure-in-c\/","name":"How to get return value from stored procedure in C#?","isPartOf":{"@id":"https:\/\/namso-gen.co\/blog\/#website"},"datePublished":"2024-12-24T10:12:03+00:00","dateModified":"2024-12-24T10:12:03+00:00","description":"To get the return value from a stored procedure in C#, you can use the `ExecuteScalar` method of the `SqlCommand` class. The return value of a stored","breadcrumb":{"@id":"https:\/\/namso-gen.co\/blog\/how-to-get-return-value-from-stored-procedure-in-c\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/namso-gen.co\/blog\/how-to-get-return-value-from-stored-procedure-in-c\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/namso-gen.co\/blog\/how-to-get-return-value-from-stored-procedure-in-c\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/namso-gen.co\/blog\/"},{"@type":"ListItem","position":2,"name":"How to get return value from stored procedure in C#?"}]},{"@type":"WebSite","@id":"https:\/\/namso-gen.co\/blog\/#website","url":"https:\/\/namso-gen.co\/blog\/","name":"Namso Gen Blog - Free Credit Card Generator [100% Valid]","description":"In Namso gen blog you can get many tips regarding to Credit cards, VCC, Credit card security etc. You can generate credit cards by using Namso-gen.co","publisher":{"@id":"https:\/\/namso-gen.co\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/namso-gen.co\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/namso-gen.co\/blog\/#organization","name":"Namso Gen Blog - Free Credit Card Generator [100% Valid]","url":"https:\/\/namso-gen.co\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/namso-gen.co\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/namso-gen.co\/blog\/wp-content\/uploads\/2020\/07\/namso-gen-logo.png","contentUrl":"https:\/\/namso-gen.co\/blog\/wp-content\/uploads\/2020\/07\/namso-gen-logo.png","width":500,"height":164,"caption":"Namso Gen Blog - Free Credit Card Generator [100% Valid]"},"image":{"@id":"https:\/\/namso-gen.co\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/synchronyfinancial","https:\/\/twitter.com\/synchrony","https:\/\/www.youtube.com\/synchronyfinancial","https:\/\/www.instagram.com\/synchrony","https:\/\/www.linkedin.com\/company\/synchrony-financial"]},{"@type":"Person","@id":"https:\/\/namso-gen.co\/blog\/#\/schema\/person\/88cd882dfb29a6b147bc0ea26dc84060","name":"Adam Forbes","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/namso-gen.co\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/?s=96&d=mm&r=g","caption":"Adam Forbes"},"description":"Guest author Adam Forbes has meticulously crafted and revised this article to the best of their knowledge and understanding. Readers are strongly advised to exercise caution, verify information independently, and rely on their own judgment when considering the information provided. Read more articles on Namso Gen here."}]}},"_links":{"self":[{"href":"https:\/\/namso-gen.co\/blog\/wp-json\/wp\/v2\/posts\/202842","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/namso-gen.co\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/namso-gen.co\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/namso-gen.co\/blog\/wp-json\/wp\/v2\/users\/51"}],"replies":[{"embeddable":true,"href":"https:\/\/namso-gen.co\/blog\/wp-json\/wp\/v2\/comments?post=202842"}],"version-history":[{"count":0,"href":"https:\/\/namso-gen.co\/blog\/wp-json\/wp\/v2\/posts\/202842\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/namso-gen.co\/blog\/wp-json\/wp\/v2\/media\/107420"}],"wp:attachment":[{"href":"https:\/\/namso-gen.co\/blog\/wp-json\/wp\/v2\/media?parent=202842"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/namso-gen.co\/blog\/wp-json\/wp\/v2\/categories?post=202842"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/namso-gen.co\/blog\/wp-json\/wp\/v2\/tags?post=202842"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}