This project presents an implementation of the ADO.NET model using both connected mode and disconnected mode. In this repository, we will learn how to handle database connections, execute SQL commands, add, read and update databases using ADO.NET.
In connected mode, ADO.NET maintains a constant connection to the database while interacting with it. The main operations are performed with the following objects:
Connection
Object and Exception Handling: The connection to the database is managed using the Connection
object, and mechanisms are implemented to handle possible exceptions during the connection.
Command
Object: Used to execute SQL commands such as queries, inserts, updates or deletes on the database.
DataReader
Object: Used to read rows of data obtained from an SQL query. It is ideal for quick and easy read operations on databases.
In disconnected mode, data is retrieved from the database and stored in local memory to be manipulated without maintaining a constant active connection. The key operations in this mode use the following objects:
DataSet
Object: A container that can store multiple data tables retrieved from the database. It is independent of the data source and allows working with data disconnected from the database.
DataAdapter
Object: Responsible for filling a DataSet
with the data retrieved from the database and performing updates to it when the data in the DataSet
is modified.
This project includes examples of how to perform data updating in the database using the DataAdapter
object, which facilitates synchronization between the modified data in the DataSet
and the original database.
The project is organized in several layers to separate business logic, data access and user interface (UI), following a three-layer architecture:
BLL (Business Logic Layer):
Negocio.vb
: Contains the business logic of the project.DAL (Data Access Layer):
Dato.vb
: Manages access to the database and SQL queries.Entities (Model Entities):
Usuario.vb
: Defines the entities or data models used in the project.UI (User Interface Layer):
frmVista.vb
: Main window of the project that interacts with the user.Desconectado.vb
: Module that implements offline mode using ADO.NET. app.config
or web.config
).