{"id":92239,"date":"2025-02-17T16:48:50","date_gmt":"2025-02-17T11:18:50","guid":{"rendered":"https:\/\/cloudfoundation.com\/blog\/?p=92239"},"modified":"2025-02-17T17:16:14","modified_gmt":"2025-02-17T11:46:14","slug":"ado-net-tutorial-for-beginners","status":"publish","type":"post","link":"https:\/\/cloudfoundation.com\/blog\/ado-net-tutorial-for-beginners\/","title":{"rendered":"ADO.Net Tutorial for Beginners"},"content":{"rendered":"<p>[et_pb_section fb_built=&#8221;1&#8243; _builder_version=&#8221;4.9.7&#8243;][et_pb_row _builder_version=&#8221;4.9.7&#8243; background_size=&#8221;initial&#8221; background_position=&#8221;top_left&#8221; background_repeat=&#8221;repeat&#8221;][et_pb_column type=&#8221;4_4&#8243; _builder_version=&#8221;3.25&#8243; custom_padding=&#8221;|||&#8221; custom_padding__hover=&#8221;|||&#8221;][et_pb_post_title meta=&#8221;off&#8221; featured_image=&#8221;off&#8221; _builder_version=&#8221;4.9.7&#8243; title_font=&#8221;Times New Roman||||||||&#8221; title_text_align=&#8221;left&#8221; title_text_color=&#8221;#000000&#8243; title_font_size=&#8221;47&#8243; background_color=&#8221;RGBA(0,0,0,0)&#8221; background_enable_image=&#8221;off&#8221; custom_margin=&#8221;|||10%&#8221; title_font_size_tablet=&#8221;40&#8243; title_font_size_phone=&#8221;35&#8243; title_font_size_last_edited=&#8221;on|desktop&#8221;][\/et_pb_post_title][\/et_pb_column][\/et_pb_row][et_pb_row _builder_version=&#8221;4.9.7&#8243; background_size=&#8221;initial&#8221; background_position=&#8221;top_left&#8221; background_repeat=&#8221;repeat&#8221; custom_padding=&#8221;31px|||||&#8221;][et_pb_column type=&#8221;4_4&#8243; _builder_version=&#8221;3.25&#8243; custom_padding=&#8221;|||&#8221; custom_padding__hover=&#8221;|||&#8221;][et_pb_text _builder_version=&#8221;4.9.7&#8243; text_font=&#8221;Georgia||||||||&#8221; text_text_color=&#8221;#000000&#8243; text_font_size=&#8221;22px&#8221; text_line_height=&#8221;1.9em&#8221; max_width=&#8221;800px&#8221; max_width_last_edited=&#8221;off|phone&#8221; custom_margin=&#8221;|||10%&#8221; custom_margin_last_edited=&#8221;off|desktop&#8221; hover_enabled=&#8221;0&#8243; text_font_size_tablet=&#8221;&#8221; text_font_size_phone=&#8221;&#8221; text_font_size_last_edited=&#8221;on|phone&#8221; text_line_height_last_edited=&#8221;off|phone&#8221; sticky_enabled=&#8221;0&#8243;]<\/p><div id=\"ez-toc-container\" class=\"ez-toc-v2_0_80 ez-toc-wrap-center counter-hierarchy ez-toc-counter ez-toc-custom ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<span class=\"ez-toc-title-toggle\"><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/cloudfoundation.com\/blog\/ado-net-tutorial-for-beginners\/#What_Is_ADONET\" >What Is ADO.NET?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/cloudfoundation.com\/blog\/ado-net-tutorial-for-beginners\/#How_to_Store_Connection_Strings_in_a_Configuration_File\" >How to Store Connection Strings in a Configuration File<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/cloudfoundation.com\/blog\/ado-net-tutorial-for-beginners\/#purpose_of_S_Q_L_command_object_and_creating_an_instance_of_this_S_Q_L_command\" >purpose of S Q L command object and creating an instance of this S Q L command<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/cloudfoundation.com\/blog\/ado-net-tutorial-for-beginners\/#So_how_do_we_tell_our_application_to_do_that\" >So how do we tell our application to do that?<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/cloudfoundation.com\/blog\/ado-net-tutorial-for-beginners\/#Execute_reader\" >Execute reader<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/cloudfoundation.com\/blog\/ado-net-tutorial-for-beginners\/#Non_Query\" >Non Query<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/cloudfoundation.com\/blog\/ado-net-tutorial-for-beginners\/#So_why_is_execute_non_query_returning_an_integer\" >So why is execute non query returning an integer?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/cloudfoundation.com\/blog\/ado-net-tutorial-for-beginners\/#Conclusion\" >Conclusion<\/a><\/li><\/ul><\/nav><\/div>\n\n<p>Companies operating in today&#8217;s fast-paced, dynamic corporate world must ensure seamless data interactions and ensure reliable connectivity between various systems and applications.<\/p>\n<p>ADO.NET provides strong data access technology which makes database integration simpler by making various data sources easier to integrate.<\/p>\n<p>Data management is centralised via ADO.NET, providing an organized method for data operations management that enhances performance while eliminating intricate coding requirements.<\/p>\n<p><img decoding=\"async\" class=\"size-medium aligncenter\" src=\"http:\/\/cloudfoundation.com\/blog\/wp-content\/uploads\/2025\/02\/ADO.NET_.jpg\" alt=\"\" width=\"800\" height=\"600\" \/><\/p>\n<p>As organisations adapt to new technologies, this allows them to connect and retrieve data from a variety of sources efficiently while guaranteeing scalability, high performance and ease of maintenance.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"What_Is_ADONET\"><\/span><strong>What Is ADO.NET?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>The ADO.NET data access technology within the.NET framework enables programs to quickly and effectively connect and work with data from different sources &#8211; including databases &#8211; quickly and effectively.<\/p>\n<p>Both connected and disconnected data models can be supported as well as tools for organizing, updating and querying.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"How_to_Store_Connection_Strings_in_a_Configuration_File\"><\/span><strong>How to Store Connection Strings in a Configuration File<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Imagine some files point at one database while others point towards another &#8211; an extremely error prone setup! For this reason, it&#8217;s recommended to store these connection strings in a configuration file for safe keeping.<\/p>\n<p>So if we have an A S P.N E T web application, this A SP.N E T application already contains web.config as its configuration file and we want to store our connection string in it, see this&#8230; it already is there.<\/p>\n<p>Within the connection string element, we can create a meaningful name for our connection string; perhaps D B C S short database connection string would suffice?<\/p>\n<p><img decoding=\"async\" class=\"size-medium aligncenter\" src=\"http:\/\/cloudfoundation.com\/blog\/wp-content\/uploads\/2025\/02\/storing-connecting-cinfiguration-file.jpg\" alt=\"\" width=\"800\" height=\"600\" \/><\/p>\n<p>Your connection string is just another means of specifying data sources or databases using its unique connection string name and string length.<\/p>\n<p>Copy and paste that into our connection string property here, then provide a name such as system.data.<\/p>\n<p>sqlFline since we will be communicating with SQL Server through it. Now we have stored our connection strings in web.config file!<\/p>\n<p>So we can delete this particular line here; since it was stored in the configuration file, but our application needs to know about that connection string.<\/p>\n<p>[\/et_pb_text][\/et_pb_column][\/et_pb_row][et_pb_row column_structure=&#8221;1_3,1_3,1_3&#8243; _builder_version=&#8221;4.9.7&#8243; _module_preset=&#8221;default&#8221; background_color=&#8221;#064399&#8243; use_background_color_gradient=&#8221;on&#8221; background_color_gradient_start=&#8221;#0095f2&#8243; background_color_gradient_end=&#8221;#7dbed8&#8243; background_color_gradient_direction=&#8221;92deg&#8221; background_color_gradient_start_position=&#8221;35%&#8221; background_color_gradient_end_position=&#8221;80%&#8221; transform_scale=&#8221;73%|62%&#8221; transform_scale_linked=&#8221;off&#8221; transform_translate=&#8221;-53px|-50px&#8221; transform_translate_linked=&#8221;off&#8221; link_option_url=&#8221;https:\/\/cloudfoundation.com\/blog\/&#8221; link_option_url_new_window=&#8221;on&#8221;][et_pb_column type=&#8221;1_3&#8243; _builder_version=&#8221;4.9.7&#8243; _module_preset=&#8221;default&#8221;][et_pb_image src=&#8221;https:\/\/cloudfoundation.com\/blog\/wp-content\/uploads\/2023\/06\/SS_436-_Converted_-1.png&#8221; _builder_version=&#8221;4.9.7&#8243; _module_preset=&#8221;default&#8221; transform_scale=&#8221;114%|112%&#8221; transform_scale_linked=&#8221;off&#8221; transform_translate=&#8221;25px|-4px&#8221; transform_translate_linked=&#8221;off&#8221; width=&#8221;98.1%&#8221; custom_margin=&#8221;|7px|||false|false&#8221;][\/et_pb_image][\/et_pb_column][et_pb_column type=&#8221;1_3&#8243; _builder_version=&#8221;4.9.7&#8243; _module_preset=&#8221;default&#8221;][et_pb_text _builder_version=&#8221;4.9.7&#8243; _module_preset=&#8221;default&#8221; text_font=&#8221;Georgia|700|||||||&#8221; text_font_size=&#8221;23px&#8221; text_line_height=&#8221;1.3em&#8221; header_font=&#8221;Georgia|700|||||||&#8221; header_font_size=&#8221;21px&#8221; header_letter_spacing=&#8221;-1px&#8221; header_line_height=&#8221;2em&#8221; transform_scale=&#8221;171%|159%&#8221; transform_scale_linked=&#8221;off&#8221; transform_translate=&#8221;40px|44px&#8221; transform_translate_linked=&#8221;off&#8221; transform_origin=&#8221;70%|50%&#8221; z_index=&#8221;-161&#8243; width=&#8221;100%&#8221; custom_margin=&#8221;|-215px||||&#8221; custom_padding=&#8221;|0px||||&#8221; link_option_url=&#8221;https:\/\/cloudfoundation.com\/?s=Power+BI&#8221; link_option_url_new_window=&#8221;on&#8221; hover_enabled=&#8221;0&#8243; sticky_enabled=&#8221;0&#8243;]<\/p>\n<h1 style=\"text-align: center;\"><span style=\"color: #ffffff;\"><strong>ADO.NET<\/strong> Training<\/span><\/h1>\n<p>[\/et_pb_text][et_pb_button button_url=&#8221;https:\/\/cloudfoundation.com\/&#8221; url_new_window=&#8221;on&#8221; button_text=&#8221;Explore Course Content&#8221; _builder_version=&#8221;4.9.7&#8243; _module_preset=&#8221;default&#8221; custom_button=&#8221;on&#8221; button_text_color=&#8221;#0C71C3&#8243; button_bg_color=&#8221;#FFFFFF&#8221; button_font=&#8221;|700|||||||&#8221; transform_translate=&#8221;64px|65px&#8221; transform_translate_linked=&#8221;off&#8221;][\/et_pb_button][\/et_pb_column][et_pb_column type=&#8221;1_3&#8243; _builder_version=&#8221;4.9.7&#8243; _module_preset=&#8221;default&#8221;][et_pb_image src=&#8221;https:\/\/cloudfoundation.com\/blog\/wp-content\/uploads\/2019\/06\/logo_resize_color.png&#8221; _builder_version=&#8221;4.9.7&#8243; _module_preset=&#8221;default&#8221; transform_translate=&#8221;-36px|0px&#8221; transform_translate_linked=&#8221;off&#8221; custom_margin=&#8221;|||178px||&#8221;][\/et_pb_image][\/et_pb_column][\/et_pb_row][et_pb_row _builder_version=&#8221;4.9.7&#8243; background_size=&#8221;initial&#8221; background_position=&#8221;top_left&#8221; background_repeat=&#8221;repeat&#8221;][et_pb_column type=&#8221;4_4&#8243; _builder_version=&#8221;3.25&#8243; custom_padding=&#8221;|||&#8221; custom_padding__hover=&#8221;|||&#8221;][et_pb_text _builder_version=&#8221;4.9.7&#8243; text_font=&#8221;Georgia||||||||&#8221; text_text_color=&#8221;#000000&#8243; text_font_size=&#8221;22px&#8221; text_line_height=&#8221;1.9em&#8221; max_width=&#8221;800px&#8221; max_width_last_edited=&#8221;off|phone&#8221; custom_margin=&#8221;|||10%&#8221; custom_margin_last_edited=&#8221;off|desktop&#8221; hover_enabled=&#8221;0&#8243; text_font_size_tablet=&#8221;&#8221; text_font_size_phone=&#8221;&#8221; text_font_size_last_edited=&#8221;on|phone&#8221; text_line_height_last_edited=&#8221;off|phone&#8221; sticky_enabled=&#8221;0&#8243;]<\/p>\n<h2><span class=\"ez-toc-section\" id=\"purpose_of_S_Q_L_command_object_and_creating_an_instance_of_this_S_Q_L_command\"><\/span><strong>purpose of S Q L command object and creating an instance of this S Q L command <\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>So we simply use that as an argument when creating our SQ L connection object and store our connection string in web.config file for easy reference.<\/p>\n<p>By doing this we also create an instance of this SQ L command object which acts like its counterpart &#8211; creating an instance of it each time we make calls against it.<\/p>\n<p>Learn the purpose and functionality of an SQ L command object, create its instance and when and how to utilize its execute reader, execute scalar, and execute non-quary methods.<\/p>\n<p><img decoding=\"async\" class=\"size-medium aligncenter\" src=\"http:\/\/cloudfoundation.com\/blog\/wp-content\/uploads\/2025\/02\/purpose-of-sql-command.jpg\" alt=\"\" width=\"800\" height=\"600\" \/><\/p>\n<p>At first, we will demonstrate how to use the S Q L command class to prepare an SQL statement and execute it against a database.<\/p>\n<p>Furthermore, we&#8217;ll show how stored procedures can also be executed using this class.<\/p>\n<p>There are three commonly utilized methods within S Q L command class &#8211; reader execution, non-quarary execution and scalar execution methods.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"So_how_do_we_tell_our_application_to_do_that\"><\/span><strong>So how do we tell our application to do that? <\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>For this task, in the. N E T framework there exists a class called Configuration Manager which serves this function. As its name implies, this class will manage my app&#8217;s configuration settings.<\/p>\n<p>Now we can use that class and then read the connection string from web.config file. Let&#8217;s use configuration manager as the class we will need &#8211; typing it here won&#8217;t find it though; system configuration contains it instead.<\/p>\n<p>Even the name space is meaningful. Now we want to handle configuration from web.config file using system.configuration namespace&#8217;s configuration manager class.<\/p>\n<p>Import system.configuration as we need a configuration manager within that namespace with connection strings property; using this will return all properties and connection strings that exist (it&#8217;s possible to have multiple connection strings in web.config file), while we only want DBCSS as one option.<\/p>\n<p>Now we can specify either an integer index. Using zero will return you directly to the initial connection string, since we only have one instance available; but as best practice it would be best to name the connection string explicitly so we know which connection string we are referring to.<\/p>\n<p>Let&#8217;s say DBCSS is our connection string name, with dot being our desired connection string value. Use that property or store in a variable and store that into string connection string that corresponds to that value.<\/p>\n<p><img decoding=\"async\" class=\"size-medium aligncenter\" src=\"http:\/\/cloudfoundation.com\/blog\/wp-content\/uploads\/2025\/02\/execute.jpg\" alt=\"\" width=\"800\" height=\"600\" \/><\/p>\n<h3><span class=\"ez-toc-section\" id=\"Execute_reader\"><\/span><strong>Execute reader<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Execute reader is typically used when we want to execute T S Q L statements that return multiple values; otherwise we use Execute nonquery; however if our query returns only a single value (known as scalar values), then Execute Scalar would be used instead.<\/p>\n<p>[\/et_pb_text][\/et_pb_column][\/et_pb_row][et_pb_row column_structure=&#8221;1_3,1_3,1_3&#8243; _builder_version=&#8221;4.9.7&#8243; _module_preset=&#8221;default&#8221; background_color=&#8221;#064399&#8243; use_background_color_gradient=&#8221;on&#8221; background_color_gradient_start=&#8221;#ff8c7c&#8221; background_color_gradient_end=&#8221;#e5ba4e&#8221; background_color_gradient_type=&#8221;radial&#8221; background_color_gradient_direction_radial=&#8221;top left&#8221; background_color_gradient_start_position=&#8221;35%&#8221; background_color_gradient_end_position=&#8221;80%&#8221; transform_scale=&#8221;74%|69%&#8221; transform_scale_linked=&#8221;off&#8221; transform_translate=&#8221;-53px|-50px&#8221; transform_translate_linked=&#8221;off&#8221; custom_margin=&#8221;||-5px||false|false&#8221; custom_padding=&#8221;|||2px|false|false&#8221; link_option_url=&#8221;https:\/\/cloudfoundation.com\/blog\/&#8221; link_option_url_new_window=&#8221;on&#8221;][et_pb_column type=&#8221;1_3&#8243; _builder_version=&#8221;4.9.7&#8243; _module_preset=&#8221;default&#8221;][et_pb_image src=&#8221;https:\/\/cloudfoundation.com\/blog\/wp-content\/uploads\/2023\/06\/8423118_3895895.png&#8221; _builder_version=&#8221;4.9.7&#8243; _module_preset=&#8221;default&#8221; width=&#8221;85.4%&#8221; custom_margin=&#8221;-31px||-24px||false|false&#8221; custom_padding=&#8221;|22px|0px||false|false&#8221;][\/et_pb_image][\/et_pb_column][et_pb_column type=&#8221;1_3&#8243; _builder_version=&#8221;4.9.7&#8243; _module_preset=&#8221;default&#8221;][et_pb_text _builder_version=&#8221;4.9.7&#8243; _module_preset=&#8221;default&#8221; text_font=&#8221;Georgia|700|||||||&#8221; text_font_size=&#8221;23px&#8221; text_line_height=&#8221;1.3em&#8221; header_font=&#8221;Georgia|700|||||||&#8221; header_font_size=&#8221;19px&#8221; header_letter_spacing=&#8221;-1px&#8221; header_line_height=&#8221;1.2em&#8221; transform_scale=&#8221;171%|159%&#8221; transform_scale_linked=&#8221;off&#8221; transform_translate=&#8221;40px|44px&#8221; transform_translate_linked=&#8221;off&#8221; transform_origin=&#8221;70%|50%&#8221; z_index=&#8221;-161&#8243; width=&#8221;100%&#8221; custom_margin=&#8221;|-215px||||&#8221; custom_padding=&#8221;|0px||||&#8221; link_option_url=&#8221;https:\/\/cloudfoundation.com\/?s=Power+BI&#8221; link_option_url_new_window=&#8221;on&#8221; hover_enabled=&#8221;0&#8243; sticky_enabled=&#8221;0&#8243;]<\/p>\n<h1 style=\"text-align: center;\"><span style=\"color: #000000;\"><strong>ADO.NET<\/strong>\u00a0Online Training<\/span><\/h1>\n<p>[\/et_pb_text][et_pb_button button_url=&#8221;https:\/\/cloudfoundation.com\/&#8221; url_new_window=&#8221;on&#8221; button_text=&#8221;Up Coming Batches&#8221; _builder_version=&#8221;4.9.7&#8243; _module_preset=&#8221;default&#8221; custom_button=&#8221;on&#8221; button_text_color=&#8221;#E09900&#8243; button_bg_color=&#8221;#FFFFFF&#8221; button_font=&#8221;|700|||||||&#8221; transform_translate=&#8221;64px|65px&#8221; transform_translate_linked=&#8221;off&#8221; background_layout=&#8221;dark&#8221;][\/et_pb_button][\/et_pb_column][et_pb_column type=&#8221;1_3&#8243; _builder_version=&#8221;4.9.7&#8243; _module_preset=&#8221;default&#8221;][et_pb_image src=&#8221;https:\/\/cloudfoundation.com\/blog\/wp-content\/uploads\/2019\/06\/logo_resize_color.png&#8221; _builder_version=&#8221;4.9.7&#8243; _module_preset=&#8221;default&#8221; transform_translate=&#8221;-36px|0px&#8221; transform_translate_linked=&#8221;off&#8221; custom_margin=&#8221;|||178px||&#8221;][\/et_pb_image][\/et_pb_column][\/et_pb_row][et_pb_row _builder_version=&#8221;4.9.7&#8243; background_size=&#8221;initial&#8221; background_position=&#8221;top_left&#8221; background_repeat=&#8221;repeat&#8221;][et_pb_column type=&#8221;4_4&#8243; _builder_version=&#8221;3.25&#8243; custom_padding=&#8221;|||&#8221; custom_padding__hover=&#8221;|||&#8221;][et_pb_text _builder_version=&#8221;4.9.7&#8243; text_font=&#8221;Georgia||||||||&#8221; text_text_color=&#8221;#000000&#8243; text_font_size=&#8221;22px&#8221; text_line_height=&#8221;1.9em&#8221; max_width=&#8221;800px&#8221; max_width_last_edited=&#8221;off|phone&#8221; custom_margin=&#8221;|||10%&#8221; custom_margin_last_edited=&#8221;off|desktop&#8221; hover_enabled=&#8221;0&#8243; text_font_size_tablet=&#8221;&#8221; text_font_size_phone=&#8221;&#8221; text_font_size_last_edited=&#8221;on|phone&#8221; text_line_height_last_edited=&#8221;off|phone&#8221; sticky_enabled=&#8221;0&#8243;]<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Non_Query\"><\/span><strong>Non Query<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Execute non query whenever your query performs an insert update or delete operation; when inserting, updating, or deleting, use non query instead of normal query to avoid data manipulation errors.<\/p>\n<p>Let&#8217;s see how to do that. Let&#8217;s say we want to insert rose into this table; given all of its columns, and their values we have provided here for T B L product table values inserted.<\/p>\n<p>Let&#8217;s write the query so it will insert rose into T B L product table values (where T is an identity column and L not).<\/p>\n<p><img decoding=\"async\" class=\"size-medium aligncenter\" src=\"http:\/\/cloudfoundation.com\/blog\/wp-content\/uploads\/2025\/02\/Non-Query.jpg\" alt=\"\" width=\"800\" height=\"600\" \/><\/p>\n<p>Let&#8217;s provide the necessary values: Primary Key = 4, Product name is calculators and there may be up to 230 available Quantities &#8211; so obviously we want to execute this query; copy that out, copy out this command that we wish to execute (e.g. &#8220;open connection&#8221;) and paste in that copy as an insert row into an existing table (which could include adding columns and updating existing data sets), then open connection based on that connection name (open it if it exists already).<\/p>\n<p>As this is an insert operation, we will instead use execute non query. IntelliSense displays its return type as integer when viewing this command: execute non query = insert operation<\/p>\n<h2><span class=\"ez-toc-section\" id=\"So_why_is_execute_non_query_returning_an_integer\"><\/span><strong>So why is execute non query returning an integer? <\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Simply, when we perform an insert update or delete, our database will tell us exactly how many rows have been inserted, updated or deleted by using an integer as its resultant number.<\/p>\n<p>Example: If the query returns the total number of rows in a table, we can use execute scalar method. Or if we are trying to calculate average salaries of employees using Excel&#8217;s pay scale feature &#8211; both are single values which must be returned. Whenever our query returns a single value like these examples above, execute scalar is used instead.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span><strong>Conclusion<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>ADO.NET is an integral data access technology of.NET programs, offering reliable ways of connecting, retrieving, and working with data. Businesses can utilize ADO.NET&#8217;s scalability, strong transaction management, support for both connected and unconnected data models as a basis for creating high-performance, data-driven apps.<\/p>\n<p>Furthermore, ADO.NET serves as an indispensable tool for developers working with databases or other forms of data services as it manages multiple sources efficiently while optimizing processes related to them.<\/p>\n<p>[\/et_pb_text][\/et_pb_column][\/et_pb_row][et_pb_row column_structure=&#8221;1_3,1_3,1_3&#8243; _builder_version=&#8221;4.9.7&#8243; _module_preset=&#8221;default&#8221; background_color=&#8221;#064399&#8243; use_background_color_gradient=&#8221;on&#8221; background_color_gradient_start=&#8221;#494fff&#8221; background_color_gradient_end=&#8221;#9ea6ff&#8221; background_color_gradient_type=&#8221;radial&#8221; background_color_gradient_direction_radial=&#8221;top left&#8221; background_color_gradient_start_position=&#8221;35%&#8221; background_color_gradient_end_position=&#8221;80%&#8221; transform_scale=&#8221;74%|71%&#8221; transform_scale_linked=&#8221;off&#8221; transform_translate=&#8221;-53px|-50px&#8221; transform_translate_linked=&#8221;off&#8221; link_option_url=&#8221;https:\/\/cloudfoundation.com\/blog\/&#8221; link_option_url_new_window=&#8221;on&#8221;][et_pb_column type=&#8221;1_3&#8243; _builder_version=&#8221;4.9.7&#8243; _module_preset=&#8221;default&#8221;][et_pb_image src=&#8221;https:\/\/cloudfoundation.com\/blog\/wp-content\/uploads\/2023\/06\/Untitled-11.png&#8221; title_text=&#8221;Untitled-11&#8243; _builder_version=&#8221;4.9.7&#8243; _module_preset=&#8221;default&#8221; transform_scale=&#8221;103%|103%&#8221; transform_scale_linked=&#8221;off&#8221; transform_translate=&#8221;11px|0px&#8221; transform_translate_linked=&#8221;off&#8221; custom_padding=&#8221;|88px||||&#8221;][\/et_pb_image][\/et_pb_column][et_pb_column type=&#8221;1_3&#8243; _builder_version=&#8221;4.9.7&#8243; _module_preset=&#8221;default&#8221;][et_pb_text _builder_version=&#8221;4.9.7&#8243; _module_preset=&#8221;default&#8221; text_font=&#8221;Georgia|700|||||||&#8221; text_text_color=&#8221;#FFFFFF&#8221; text_font_size=&#8221;23px&#8221; text_line_height=&#8221;1.3em&#8221; header_font=&#8221;Georgia|700|||||||&#8221; header_font_size=&#8221;19px&#8221; header_letter_spacing=&#8221;-1px&#8221; header_line_height=&#8221;1.2em&#8221; transform_scale=&#8221;171%|159%&#8221; transform_scale_linked=&#8221;off&#8221; transform_translate=&#8221;40px|44px&#8221; transform_translate_linked=&#8221;off&#8221; transform_origin=&#8221;70%|50%&#8221; z_index=&#8221;-161&#8243; width=&#8221;100%&#8221; custom_margin=&#8221;|-215px||||&#8221; custom_padding=&#8221;|0px||||&#8221; link_option_url=&#8221;https:\/\/cloudfoundation.com\/?s=Power+BI&#8221; link_option_url_new_window=&#8221;on&#8221; hover_enabled=&#8221;0&#8243; sticky_enabled=&#8221;0&#8243;]<\/p>\n<h1 style=\"text-align: center;\"><span style=\"color: #ffffff;\"><strong>ADO.NET Course Price<\/strong><\/span><\/h1>\n<p>[\/et_pb_text][et_pb_button button_url=&#8221;https:\/\/cloudfoundation.com\/&#8221; url_new_window=&#8221;on&#8221; button_text=&#8221;Offer Price&#8221; _builder_version=&#8221;4.9.7&#8243; _module_preset=&#8221;default&#8221; custom_button=&#8221;on&#8221; button_text_color=&#8221;#0C71C3&#8243; button_bg_color=&#8221;#FFFFFF&#8221; button_font=&#8221;|700|||||||&#8221; transform_translate=&#8221;64px|65px&#8221; transform_translate_linked=&#8221;off&#8221;][\/et_pb_button][\/et_pb_column][et_pb_column type=&#8221;1_3&#8243; _builder_version=&#8221;4.9.7&#8243; _module_preset=&#8221;default&#8221;][et_pb_image src=&#8221;https:\/\/cloudfoundation.com\/blog\/wp-content\/uploads\/2019\/06\/logo_resize_color.png&#8221; title_text=&#8221;logo_resize_color&#8221; _builder_version=&#8221;4.9.7&#8243; _module_preset=&#8221;default&#8221; transform_translate=&#8221;-36px|0px&#8221; transform_translate_linked=&#8221;off&#8221; custom_margin=&#8221;|||178px||&#8221;][\/et_pb_image][\/et_pb_column][\/et_pb_row][et_pb_row _builder_version=&#8221;4.9.7&#8243; background_size=&#8221;initial&#8221; background_position=&#8221;top_left&#8221; background_repeat=&#8221;repeat&#8221;][et_pb_column type=&#8221;4_4&#8243; _builder_version=&#8221;3.25&#8243; custom_padding=&#8221;|||&#8221; custom_padding__hover=&#8221;|||&#8221;][et_pb_team_member name=&#8221;G. Madhavi&#8221; position=&#8221;Author&#8221; image_url=&#8221;https:\/\/cloudfoundation.com\/blog\/wp-content\/uploads\/2024\/11\/G.madhavi-e1732957223619.png&#8221; _builder_version=&#8221;4.9.7&#8243; header_level=&#8221;h5&#8243; header_font=&#8221;Titillium Web|700|||||||&#8221; body_font=&#8221;Titillium Web||||||||&#8221; body_font_size=&#8221;16&#8243;]The capacity to learn is a gift the ability to learn is a skill the willingness to learn is a choice[\/et_pb_team_member][\/et_pb_column][\/et_pb_row][\/et_pb_section]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>[et_pb_section fb_built=&#8221;1&#8243; _builder_version=&#8221;4.9.7&#8243;][et_pb_row _builder_version=&#8221;4.9.7&#8243; background_size=&#8221;initial&#8221; background_position=&#8221;top_left&#8221; background_repeat=&#8221;repeat&#8221;][et_pb_column type=&#8221;4_4&#8243; _builder_version=&#8221;3.25&#8243; custom_padding=&#8221;|||&#8221; custom_padding__hover=&#8221;|||&#8221;][et_pb_post_title meta=&#8221;off&#8221; featured_image=&#8221;off&#8221; _builder_version=&#8221;4.9.7&#8243; title_font=&#8221;Times New Roman||||||||&#8221; title_text_align=&#8221;left&#8221; title_text_color=&#8221;#000000&#8243; title_font_size=&#8221;47&#8243; background_color=&#8221;RGBA(0,0,0,0)&#8221; background_enable_image=&#8221;off&#8221; custom_margin=&#8221;|||10%&#8221; title_font_size_tablet=&#8221;40&#8243; title_font_size_phone=&#8221;35&#8243; title_font_size_last_edited=&#8221;on|desktop&#8221;][\/et_pb_post_title][\/et_pb_column][\/et_pb_row][et_pb_row _builder_version=&#8221;4.9.7&#8243; background_size=&#8221;initial&#8221; background_position=&#8221;top_left&#8221; background_repeat=&#8221;repeat&#8221; custom_padding=&#8221;31px|||||&#8221;][et_pb_column type=&#8221;4_4&#8243; _builder_version=&#8221;3.25&#8243; custom_padding=&#8221;|||&#8221; custom_padding__hover=&#8221;|||&#8221;][et_pb_text _builder_version=&#8221;4.9.7&#8243; text_font=&#8221;Georgia||||||||&#8221; text_text_color=&#8221;#000000&#8243; text_font_size=&#8221;22px&#8221; text_line_height=&#8221;1.9em&#8221; max_width=&#8221;800px&#8221; max_width_last_edited=&#8221;off|phone&#8221; custom_margin=&#8221;|||10%&#8221; custom_margin_last_edited=&#8221;off|desktop&#8221; hover_enabled=&#8221;0&#8243; text_font_size_tablet=&#8221;&#8221; text_font_size_phone=&#8221;&#8221; text_font_size_last_edited=&#8221;on|phone&#8221; text_line_height_last_edited=&#8221;off|phone&#8221; sticky_enabled=&#8221;0&#8243;] Companies operating in today&#8217;s fast-paced, [&hellip;]<\/p>\n","protected":false},"author":7,"featured_media":92260,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"on","_et_pb_old_content":"","_et_gb_content_width":"2880","footnotes":""},"categories":[1],"tags":[],"class_list":{"0":"post-92239","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-uncategorized"},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>ADO.Net Tutorial for Beginners<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/cloudfoundation.com\/blog\/ado-net-tutorial-for-beginners\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"ADO.Net Tutorial for Beginners\" \/>\n<meta property=\"og:description\" content=\"[et_pb_section fb_built=&#8221;1&#8243; _builder_version=&#8221;4.9.7&#8243;][et_pb_row _builder_version=&#8221;4.9.7&#8243; background_size=&#8221;initial&#8221; background_position=&#8221;top_left&#8221; background_repeat=&#8221;repeat&#8221;][et_pb_column type=&#8221;4_4&#8243; _builder_version=&#8221;3.25&#8243; custom_padding=&#8221;|||&#8221; custom_padding__hover=&#8221;|||&#8221;][et_pb_post_title meta=&#8221;off&#8221; featured_image=&#8221;off&#8221; _builder_version=&#8221;4.9.7&#8243; title_font=&#8221;Times New Roman||||||||&#8221; title_text_align=&#8221;left&#8221; title_text_color=&#8221;#000000&#8243; title_font_size=&#8221;47&#8243; background_color=&#8221;RGBA(0,0,0,0)&#8221; background_enable_image=&#8221;off&#8221; custom_margin=&#8221;|||10%&#8221; title_font_size_tablet=&#8221;40&#8243; title_font_size_phone=&#8221;35&#8243; title_font_size_last_edited=&#8221;on|desktop&#8221;][\/et_pb_post_title][\/et_pb_column][\/et_pb_row][et_pb_row _builder_version=&#8221;4.9.7&#8243; background_size=&#8221;initial&#8221; background_position=&#8221;top_left&#8221; background_repeat=&#8221;repeat&#8221; custom_padding=&#8221;31px|||||&#8221;][et_pb_column type=&#8221;4_4&#8243; _builder_version=&#8221;3.25&#8243; custom_padding=&#8221;|||&#8221; custom_padding__hover=&#8221;|||&#8221;][et_pb_text _builder_version=&#8221;4.9.7&#8243; text_font=&#8221;Georgia||||||||&#8221; text_text_color=&#8221;#000000&#8243; text_font_size=&#8221;22px&#8221; text_line_height=&#8221;1.9em&#8221; max_width=&#8221;800px&#8221; max_width_last_edited=&#8221;off|phone&#8221; custom_margin=&#8221;|||10%&#8221; custom_margin_last_edited=&#8221;off|desktop&#8221; hover_enabled=&#8221;0&#8243; text_font_size_tablet=&#8221;&#8221; text_font_size_phone=&#8221;&#8221; text_font_size_last_edited=&#8221;on|phone&#8221; text_line_height_last_edited=&#8221;off|phone&#8221; sticky_enabled=&#8221;0&#8243;] Companies operating in today&#8217;s fast-paced, [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/cloudfoundation.com\/blog\/ado-net-tutorial-for-beginners\/\" \/>\n<meta property=\"og:site_name\" content=\"CloudFoundation | Blog\" \/>\n<meta property=\"article:published_time\" content=\"2025-02-17T11:18:50+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-02-17T11:46:14+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/cloudfoundation.com\/blog\/wp-content\/uploads\/2025\/02\/Leonardo_Phoenix_10_A_hightech_digital_illustration_representi_0-1.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"800\" \/>\n\t<meta property=\"og:image:height\" content=\"500\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"NAGENDRAG\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"NAGENDRAG\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"ADO.Net Tutorial for Beginners","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:\/\/cloudfoundation.com\/blog\/ado-net-tutorial-for-beginners\/","og_locale":"en_US","og_type":"article","og_title":"ADO.Net Tutorial for Beginners","og_description":"[et_pb_section fb_built=&#8221;1&#8243; _builder_version=&#8221;4.9.7&#8243;][et_pb_row _builder_version=&#8221;4.9.7&#8243; background_size=&#8221;initial&#8221; background_position=&#8221;top_left&#8221; background_repeat=&#8221;repeat&#8221;][et_pb_column type=&#8221;4_4&#8243; _builder_version=&#8221;3.25&#8243; custom_padding=&#8221;|||&#8221; custom_padding__hover=&#8221;|||&#8221;][et_pb_post_title meta=&#8221;off&#8221; featured_image=&#8221;off&#8221; _builder_version=&#8221;4.9.7&#8243; title_font=&#8221;Times New Roman||||||||&#8221; title_text_align=&#8221;left&#8221; title_text_color=&#8221;#000000&#8243; title_font_size=&#8221;47&#8243; background_color=&#8221;RGBA(0,0,0,0)&#8221; background_enable_image=&#8221;off&#8221; custom_margin=&#8221;|||10%&#8221; title_font_size_tablet=&#8221;40&#8243; title_font_size_phone=&#8221;35&#8243; title_font_size_last_edited=&#8221;on|desktop&#8221;][\/et_pb_post_title][\/et_pb_column][\/et_pb_row][et_pb_row _builder_version=&#8221;4.9.7&#8243; background_size=&#8221;initial&#8221; background_position=&#8221;top_left&#8221; background_repeat=&#8221;repeat&#8221; custom_padding=&#8221;31px|||||&#8221;][et_pb_column type=&#8221;4_4&#8243; _builder_version=&#8221;3.25&#8243; custom_padding=&#8221;|||&#8221; custom_padding__hover=&#8221;|||&#8221;][et_pb_text _builder_version=&#8221;4.9.7&#8243; text_font=&#8221;Georgia||||||||&#8221; text_text_color=&#8221;#000000&#8243; text_font_size=&#8221;22px&#8221; text_line_height=&#8221;1.9em&#8221; max_width=&#8221;800px&#8221; max_width_last_edited=&#8221;off|phone&#8221; custom_margin=&#8221;|||10%&#8221; custom_margin_last_edited=&#8221;off|desktop&#8221; hover_enabled=&#8221;0&#8243; text_font_size_tablet=&#8221;&#8221; text_font_size_phone=&#8221;&#8221; text_font_size_last_edited=&#8221;on|phone&#8221; text_line_height_last_edited=&#8221;off|phone&#8221; sticky_enabled=&#8221;0&#8243;] Companies operating in today&#8217;s fast-paced, [&hellip;]","og_url":"https:\/\/cloudfoundation.com\/blog\/ado-net-tutorial-for-beginners\/","og_site_name":"CloudFoundation | Blog","article_published_time":"2025-02-17T11:18:50+00:00","article_modified_time":"2025-02-17T11:46:14+00:00","og_image":[{"width":800,"height":500,"url":"http:\/\/cloudfoundation.com\/blog\/wp-content\/uploads\/2025\/02\/Leonardo_Phoenix_10_A_hightech_digital_illustration_representi_0-1.jpg","type":"image\/jpeg"}],"author":"NAGENDRAG","twitter_card":"summary_large_image","twitter_misc":{"Written by":"NAGENDRAG","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/cloudfoundation.com\/blog\/ado-net-tutorial-for-beginners\/","url":"https:\/\/cloudfoundation.com\/blog\/ado-net-tutorial-for-beginners\/","name":"ADO.Net Tutorial for Beginners","isPartOf":{"@id":"https:\/\/cloudfoundation.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/cloudfoundation.com\/blog\/ado-net-tutorial-for-beginners\/#primaryimage"},"image":{"@id":"https:\/\/cloudfoundation.com\/blog\/ado-net-tutorial-for-beginners\/#primaryimage"},"thumbnailUrl":"https:\/\/cloudfoundation.com\/blog\/wp-content\/uploads\/2025\/02\/Leonardo_Phoenix_10_A_hightech_digital_illustration_representi_0-1.jpg","datePublished":"2025-02-17T11:18:50+00:00","dateModified":"2025-02-17T11:46:14+00:00","author":{"@id":"https:\/\/cloudfoundation.com\/blog\/#\/schema\/person\/df6c7eba98f1bb15f2a100a9958266e4"},"breadcrumb":{"@id":"https:\/\/cloudfoundation.com\/blog\/ado-net-tutorial-for-beginners\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/cloudfoundation.com\/blog\/ado-net-tutorial-for-beginners\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/cloudfoundation.com\/blog\/ado-net-tutorial-for-beginners\/#primaryimage","url":"https:\/\/cloudfoundation.com\/blog\/wp-content\/uploads\/2025\/02\/Leonardo_Phoenix_10_A_hightech_digital_illustration_representi_0-1.jpg","contentUrl":"https:\/\/cloudfoundation.com\/blog\/wp-content\/uploads\/2025\/02\/Leonardo_Phoenix_10_A_hightech_digital_illustration_representi_0-1.jpg","width":800,"height":500},{"@type":"BreadcrumbList","@id":"https:\/\/cloudfoundation.com\/blog\/ado-net-tutorial-for-beginners\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/cloudfoundation.com\/blog\/"},{"@type":"ListItem","position":2,"name":"ADO.Net Tutorial for Beginners"}]},{"@type":"WebSite","@id":"https:\/\/cloudfoundation.com\/blog\/#website","url":"https:\/\/cloudfoundation.com\/blog\/","name":"CloudFoundation | Blog","description":"A New way of Learning","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/cloudfoundation.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/cloudfoundation.com\/blog\/#\/schema\/person\/df6c7eba98f1bb15f2a100a9958266e4","name":"NAGENDRAG","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/cloudfoundation.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/09e08ba1102807a876f2c00245d6b955f0a9f027b40c181e9cee0cd2d927f84a?s=96&d=wavatar&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/09e08ba1102807a876f2c00245d6b955f0a9f027b40c181e9cee0cd2d927f84a?s=96&d=wavatar&r=g","caption":"NAGENDRAG"},"url":"https:\/\/cloudfoundation.com\/blog\/author\/nagendrag\/"}]}},"_links":{"self":[{"href":"https:\/\/cloudfoundation.com\/blog\/wp-json\/wp\/v2\/posts\/92239","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cloudfoundation.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cloudfoundation.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cloudfoundation.com\/blog\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/cloudfoundation.com\/blog\/wp-json\/wp\/v2\/comments?post=92239"}],"version-history":[{"count":14,"href":"https:\/\/cloudfoundation.com\/blog\/wp-json\/wp\/v2\/posts\/92239\/revisions"}],"predecessor-version":[{"id":92280,"href":"https:\/\/cloudfoundation.com\/blog\/wp-json\/wp\/v2\/posts\/92239\/revisions\/92280"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/cloudfoundation.com\/blog\/wp-json\/wp\/v2\/media\/92260"}],"wp:attachment":[{"href":"https:\/\/cloudfoundation.com\/blog\/wp-json\/wp\/v2\/media?parent=92239"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cloudfoundation.com\/blog\/wp-json\/wp\/v2\/categories?post=92239"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cloudfoundation.com\/blog\/wp-json\/wp\/v2\/tags?post=92239"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}