Master technical and career interviews with structured answers—short definition, real examples, pitfalls, and how to answer in 60–90 seconds.
DO.NET (Active Data Objects .NET) is a data access technology in the .NET framework that enables applications to interact with databases and other data sources. It provides a set of classes for connecting to databases, r…
nd forth between rows (using DataRow and DataColumn). DataReader: A DataReader is a forward-only, read-only data cursor. It provides faster, streaming access to the data from the database but doesn’t allow modifications.…
DataSet: It is a disconnected, in-memory data structure that can hold multiple tables. It can also be updated and later written back to the database. You can move back and forth between rows (using DataRow and DataColumn…
DataAdapter serves as a bridge between a DataSet/DataTable and the database. It is used to fill a DataSet with data and to update changes made in the DataSet back to the database. Example: SqlDataAdapter adapter = new Sq…
The Command object is used to execute SQL queries or stored procedures against a database. It encapsulates the SQL statement or stored procedure and returns results. Example: SqlCommand command = new SqlCommand("SELECT *…
Follow: ExecuteNonQuery: Executes SQL commands that do not return data (e.g., INSERT, UPDATE, DELETE). Example: command.ExecuteNonQuery(); (used to insert a record). ExecuteReader: Executes SQL commands that return rows…
The ConnectionString contains information required to connect to the database, such as the database server, database name, credentials, and other configurations. Example: string connectionString = "Data Source=server_nam…
SqlConnection: Used specifically for connecting to SQL Server databases. OleDbConnection: A more general connection class that can connect to a variety of data sources, such as MS Access, Excel, Oracle, etc. Example: Use…
SQLCommand: A SQL command is a string of SQL code (like SELECT, INSERT, etc.) that is executed directly against the database. Stored Procedure: A precompiled collection of SQL statements that can be executed as a unit. I…
Connection Pooling allows multiple applications or threads to reuse existing database connections instead of opening a new connection each time. It improves performance by reducing the overhead of opening and closing con…
The CommandTimeout property specifies the amount of time (in seconds) before a command is considered to have timed out. If the command execution takes longer than the specified time, an error is raised. Example: SqlComma…
Answer: The SqlDataAdapter serves as a bridge between a DataSet (or DataTable) and the database. It is responsible for: What interviewers expect A clear definition tied to ADO.NET in ADO.NET projects Trade-offs (performa…
mount of data quickly and do not need to modify the data. It requires an open connection to the database and reads data sequentially, one row at a time. Example: SqlCommand command = new SqlCommand("SELECT CustomerName F…
The SqlDataReader is used to retrieve data from the database in a forward-only and read-only manner. It is more efficient than a DataSet when you need to retrieve a large amount of data quickly and do not need to modify…
Answer: dapter.Fill(dataset, "Customers"); // Fills the DataSet with data from the "Customers" table What interviewers expect A clear definition tied to ADO.NET in ADO.NET projects Trade-offs (performance, maintainabilit…
DataSet is a collection of DataTable objects, and it can hold multiple tables and relationships between them. It is used for handling disconnected data and can work offline, and it can also support complex structures, su…
The SqlConnection object is responsible for opening a connection to a SQL Server database. It represents the physical connection to the data source and must be open before executing commands (like SqlCommand) or reading…
Strongly Typed DataSet: A DataSet that is generated from an XSD (XML Schema Definition) file, which defines the structure of the data (tables, columns, relationships). It provides type safety and compile-time checking. L…
Answer: transaction in ADO.NET is a sequence of database operations that are executed as a single unit. If one operation fails, all previous operations are rolled back. You can manage transactions using the SqlTransactio…
way to safely and securely inject data into queries, reducing the risk of SQL injection ttacks. In ADO.NET, you handle parameters using the Parameters collection of a SqlCommand object. Example: SqlCommand command = new…
Parameters are used to pass values to SQL commands or stored procedures. They provide a way to safely and securely inject data into queries, reducing the risk of SQL injection attacks. In ADO.NET, you handle parameters u…
Answer: snapshot of the data and remains unchanged even if the data in the database changes during the operation. It is slower and consumes more memory compared to forward-only cursor. What interviewers expect A clear de…
Forward-only cursor: A cursor that allows you to read rows sequentially in a forward direction only. It is fast and lightweight, but you cannot go back to previous rows. Static cursor: A cursor that allows both forward a…
n ADO.NET DataProvider is a set of classes used to interact with different types of data sources (such as SQL Server, Oracle, etc.). It provides methods for opening connections, executing commands, and retrieving data. T…
llows you to define the name, data type, size, and value of a parameter. SqlParameter is used to protect against SQL injection and to pass data to SQL queries safely. Example: SqlCommand command = new SqlCommand("SELECT…
ADO.NET ADO.NET Core Tutorial · ADO.NET
DO.NET (Active Data Objects .NET) is a data access technology in the .NET framework
that enables applications to interact with databases and other data sources. It provides a set
of classes for connecting to databases, retrieving data, manipulating data, and updating
data. ADO.NET is designed for disconnected data access, meaning that data can be
retrieved, modified, and worked with without maintaining an ongoing connection to the
database.
Real-Time Example:
In a C# application, ADO.NET is used to retrieve a list of products from a database and
display it in a UI like a GridView. The data is fetched from the database, stored in a DataSet
or DataTable, and then bound to the UI controls.
ADO.NET ADO.NET Core Tutorial · ADO.NET
nd forth between rows (using DataRow and DataColumn).
faster, streaming access to the data from the database but doesn’t allow
modifications. It maintains an open connection while reading data.
Example:
Orders, and Products, you'd use a DataSet.
DataReader would be used.
ADO.NET ADO.NET Core Tutorial · ADO.NET
It can also be updated and later written back to the database. You can move back
and forth between rows (using DataRow and DataColumn).
faster, streaming access to the data from the database but doesn’t allow
modifications. It maintains an open connection while reading data.
Example:
Orders, and Products, you'd use a DataSet.
DataReader would be used.
ADO.NET ADO.NET Core Tutorial · ADO.NET
DataAdapter serves as a bridge between a DataSet/DataTable and the database. It is
used to fill a DataSet with data and to update changes made in the DataSet back to the
database.
Example:
SqlDataAdapter adapter = new SqlDataAdapter("SELECT * FROM
Customers", connection);
DataSet dataset = new DataSet();
dapter.Fill(dataset, "Customers"); // Fills DataSet with data from
the Customers table
ADO.NET ADO.NET Core Tutorial · ADO.NET
The Command object is used to execute SQL queries or stored procedures against a
database. It encapsulates the SQL statement or stored procedure and returns results.
Example:
SqlCommand command = new SqlCommand("SELECT * FROM Customers",
connection);
SqlDataReader reader = command.ExecuteReader();ADO.NET ADO.NET Core Tutorial · ADO.NET
Follow:
UPDATE, DELETE).
It returns a DataReader.
cell of data).
aggregate values).
ADO.NET ADO.NET Core Tutorial · ADO.NET
The ConnectionString contains information required to connect to the database, such as
the database server, database name, credentials, and other configurations.
Example:
string connectionString = "Data Source=server_name;Initial
Catalog=database_name;User ID=user_name;Password=password;";ADO.NET ADO.NET Core Tutorial · ADO.NET
data sources, such as MS Access, Excel, Oracle, etc.
Example:
Use SqlConnection for SQL Server:
SqlConnection sqlConnection = new SqlConnection(connectionString);
OleDbConnection oleDbConnection = new
OleDbConnection(connectionString);
ADO.NET ADO.NET Core Tutorial · ADO.NET
etc.) that is executed directly against the database.
executed as a unit. It can contain more complex logic, including control-of-flow and
error handling.
Example:
ADO.NET ADO.NET Core Tutorial · ADO.NET
Connection Pooling allows multiple applications or threads to reuse existing database
connections instead of opening a new connection each time. It improves performance by
reducing the overhead of opening and closing connections repeatedly.
Example: When using SQL Server, the connection pool automatically manages the reuse of
connections.
ADO.NET ADO.NET Core Tutorial · ADO.NET
The CommandTimeout property specifies the amount of time (in seconds) before a
command is considered to have timed out. If the command execution takes longer than the
specified time, an error is raised.
Example:
SqlCommand command = new SqlCommand("SELECT * FROM Customers",
connection);
command.CommandTimeout = 30; // Timeout after 30 seconds
Intermediate ADO.NET QuestionsADO.NET ADO.NET Core Tutorial · ADO.NET
Answer: The SqlDataAdapter serves as a bridge between a DataSet (or DataTable) and the database. It is responsible for:
In a production ADO.NET application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
ADO.NET ADO.NET Core Tutorial · ADO.NET
mount of data quickly and do not need to modify the data. It requires an open connection to
the database and reads data sequentially, one row at a time.
Example:
SqlCommand command = new SqlCommand("SELECT CustomerName FROM
Customers", connection);
SqlDataReader reader = command.ExecuteReader();
while (reader.Read())
{
Console.WriteLine(reader["CustomerName"]);
}
reader.Close();
ADO.NET ADO.NET Core Tutorial · ADO.NET
The SqlDataReader is used to retrieve data from the database in a forward-only and
read-only manner. It is more efficient than a DataSet when you need to retrieve a large
amount of data quickly and do not need to modify the data. It requires an open connection to
the database and reads data sequentially, one row at a time.
Example:
SqlCommand command = new SqlCommand("SELECT CustomerName FROM
Customers", connection);
SqlDataReader reader = command.ExecuteReader();
while (reader.Read())
Console.WriteLine(reader["CustomerName"]);
reader.Close();
ADO.NET ADO.NET Core Tutorial · ADO.NET
Answer: dapter.Fill(dataset, "Customers"); // Fills the DataSet with data from the "Customers" table
In a production ADO.NET application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
ADO.NET ADO.NET Core Tutorial · ADO.NET
relationships between them. It is used for handling disconnected data and can work
offline, and it can also support complex structures, such as parent-child relationships.
can be used for simpler scenarios where only one table of data is needed.
Example:
ADO.NET ADO.NET Core Tutorial · ADO.NET
The SqlConnection object is responsible for opening a connection to a SQL Server
database. It represents the physical connection to the data source and must be open before
executing commands (like SqlCommand) or reading data (using SqlDataReader or
SqlDataAdapter).
Example:
SqlConnection connection = new SqlConnection(connectionString);
connection.Open();
// Execute database commands
connection.Close();
ADO.NET ADO.NET Core Tutorial · ADO.NET
Definition) file, which defines the structure of the data (tables, columns,
relationships). It provides type safety and compile-time checking.
meaning you access tables and columns by name at runtime. This offers flexibility but
no compile-time checking.
Example:
intellisense.ADO.NET ADO.NET Core Tutorial · ADO.NET
Answer: transaction in ADO.NET is a sequence of database operations that are executed as a single unit. If one operation fails, all previous operations are rolled back. You can manage transactions using the SqlTransaction object. Steps:
In a production ADO.NET application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
ADO.NET ADO.NET Core Tutorial · ADO.NET
way to safely and securely inject data into queries, reducing the risk of SQL injection
ttacks.
In ADO.NET, you handle parameters using the Parameters collection of a SqlCommand
object.
Example:
SqlCommand command = new SqlCommand("SELECT * FROM Customers WHERE
CustomerID = @CustomerID", connection);
command.Parameters.AddWithValue("@CustomerID", customerId);
ADO.NET ADO.NET Core Tutorial · ADO.NET
Parameters are used to pass values to SQL commands or stored procedures. They provide
a way to safely and securely inject data into queries, reducing the risk of SQL injection
attacks.
In ADO.NET, you handle parameters using the Parameters collection of a SqlCommand
object.
Example:
SqlCommand command = new SqlCommand("SELECT * FROM Customers WHERE
CustomerID = @CustomerID", connection);
command.Parameters.AddWithValue("@CustomerID", customerId);
ADO.NET ADO.NET Core Tutorial · ADO.NET
Answer: snapshot of the data and remains unchanged even if the data in the database changes during the operation. It is slower and consumes more memory compared to forward-only cursor.
In a production ADO.NET application, teams apply this when handling user-facing features or integration boundaries. For example, you might use it during a sprint where reliability and observability matter—logging metrics, validating edge cases, and documenting the decision in an ADR so future developers understand why the approach was chosen.
Tip: Practice aloud on Toolliyo mock interview or the Interview Q&A section before your real interview.
ADO.NET ADO.NET Core Tutorial · ADO.NET
direction only. It is fast and lightweight, but you cannot go back to previous rows.
a snapshot of the data and remains unchanged even if the data in the database
changes during the operation. It is slower and consumes more memory compared to
a forward-only cursor.
ADO.NET ADO.NET Core Tutorial · ADO.NET
n ADO.NET DataProvider is a set of classes used to interact with different types of data
sources (such as SQL Server, Oracle, etc.). It provides methods for opening connections,
executing commands, and retrieving data.
The main types of DataProviders are:
ADO.NET ADO.NET Core Tutorial · ADO.NET
llows you to define the name, data type, size, and value of a parameter. SqlParameter is
used to protect against SQL injection and to pass data to SQL queries safely.
Example:
SqlCommand command = new SqlCommand("SELECT * FROM Customers WHERE
CustomerID = @CustomerID", connection);
SqlParameter parameter = new SqlParameter("@CustomerID",
SqlDbType.Int);
parameter.Value = customerId;
command.Parameters.Add(parameter);