
Explore ADO.NET, a Microsoft backend technology for data access. Learn how web.config governs configuration and how to install SQL Server to enable database connectivity.
Explore how client-server architecture enables communication between clients and servers over the internet, leveraging a global database and databases like SQL Server or Access to provide data to applications.
Learn how to create a database table in SQL using the create table syntax, define columns with data types, and set a primary key in a SQL Server environment.
Learn how to use alter table to add, drop, and modify columns in an existing table, with examples like adding an email field to customers and changing its data type.
Master dropping tables with an SQL drop query, using drop table followed by the table name. Practice creating and dropping tables like employees and representatives in a catalog database.
Learn to use sql insert into statements to add records, either by specifying columns or inserting all fields, ensuring values match and strings use quotes, including customer and person tables.
Master update queries in SQL to modify records in a table, using the set and where clauses to update specific rows or multiple fields like address and salary by ID.
Master the or clause in sql by querying the persons table to fetch last name, age, and city where age > 35 or city = Bangalore.
Create a persons table with an auto-incrementing primary key and not-null fields (last name, first name, city, age), then insert rows to display identity-generated IDs.
Learn to build your first console application in C# by handling input and output, summing two numbers, and displaying the result.
Discover how to create your first ASP.NET application by starting a new project, selecting a project option, naming the project, and organizing its folder structure.
Learn how to open and explicitly close a SQL Server connection using the SqlConnection class, with connection strings and integrated security or user credentials.
Explore how to use SqlCommand with a connection, set command text, and execute queries in ADO.NET, then leverage SqlDataAdapter to fill data and SqlDataReader for forward-only reading.
Learn to populate a grid view from a database table in a Visual Studio project using a data adapter and dataset, with a focus on select queries and field binding.
Learn to populate a GridView using a stored procedure in ADO.NET, including creating, executing, and refreshing a procedure that selects from a catalog table and displays the top 200 records.
Insert data into a database by defining a table with fields like user name and textbooks, then enter records via a one-click insertion workflow.
Learn to create and execute a stored procedure for inserting rows into a table in management studio, selecting fields, handling values, and ensuring accurate execution.
Learn to use a stored procedure to insert records into a database table by defining and binding parameters for fields such as name and city in a C# ADO.NET workflow.
This lecture demonstrates performing an update on a database table with C# and ADO.NET, detailing update query design, field mapping, and managing the open connection.
learn to create a stored procedure for updating tables in table-management studio, focusing on correct field formatting with prefixes, handling names, and executing the update query.
Update database tables using a stored procedure in a code-behind context, covering command creation, connection handling, parameter binding for fields like name and city, and validation controls.
Learn to implement a delete operation in a database by wiring a grid's delete button to the server, matching fields and conditions to remove table rows.
Learn how to use a stored procedure to delete records from a table in SQL Server Management Studio, including parameter handling and execution considerations.
Learn to delete records from a table using a stored procedure in code-behind, including parameter inputs, output handling, and wiring the delete operation to the UI.
Utilize ADO.NET to implement strict database filtering by city and profession, drive a searchable grid interface, and refine results with a single-click search and dynamic data binding.
ADODotNET is a set of classes (a framework) to interact with data sources such as databases and XML files. ADO is the acronym for ActiveX Data Objects. It allows us to connect to underlying data or databases. It has classes and methods to retrieve and manipulate data.
The following are a few of the dot NET applications that use ADODotNET to connect to a database, execute commands and retrieve data from the database.
ASP.NET Web Applications
Console Applications
Windows Applications.
Various Connection Architectures
There are the following two types of connection architectures:
Connected architecture: the application remains connected with the database throughout the processing.
Disconnected architecture: the application automatically connects/disconnects during the processing. The application uses temporary data on the application side called a DataSet
Important Classes in ADODotNET
We can also observe various classes in the preceding diagram. They are:
Connection Class
Command Class
DataReader Class
DataAdaptor Class
DataSet Class
1. Connection Class
In ADODotNET, we use these connection classes to connect to the database. These connection classes also manage transactions and connection pooling. To learn more about connection classes, start here: Connection in ADODotNET
2. Command Class
The Command class provides methods for storing and executing SQL statements and Stored Procedures. The following are the various commands that are executed by the Command Class.
ExecuteReader: Returns data to the client as rows. This would typically be an SQL select statement or a Stored Procedure that contains one or more select statements. This method returns a DataReader object that can be used to fill a DataTable object or used directly for printing reports and so forth.
ExecuteNonQuery: Executes a command that changes the data in the database, such as an update, delete, or insert statement, or a Stored Procedure that contains one or more of these statements. This method returns an integer that is the number of rows affected by the query.
ExecuteScalar: This method only returns a single value. This kind of query returns a count of rows or a calculated value.
ExecuteXMLReader: (SqlClient classes only) Obtains data from an SQL Server 2000 database using an XML stream. Returns an XML Reader object.
3. DataReader Class
The DataReader is used to retrieve data. It is used in conjunction with the Command class to execute an SQL Select statement and then access the returned rows. Learn more here: Data Reader in C#.
4. DataAdapter Class
The DataAdapter is used to connect DataSets to databases. The DataAdapter is most useful when using data-bound controls in Windows Forms, but it can also be used to provide an easy way to manage the connection between your application and the underlying database tables, views and Stored Procedures. Learn more here: Data Adapter in ADODotNET
5. DataSet Class
The DataSet is the heart of ADODotNET . The DataSet is essentially a collection of DataTable objects. In turn each object contains a collection of DataColumn and DataRow objects. The DataSet also contains a Relations collection that can be used to define relations among Data Table Objects.